Link do numeru sprawy na GitHub w wiadomości zatwierdzania

Czy jest w jakiś sposób możliwe, aby automatycznie mieć link do numeru sprawy na Githubie w wiadomości git commit?

Author: Mateusz Piotrowski, 2009-11-06

8 answers

Po prostu dołącz #xxx do komunikatu zatwierdzającego, aby odwołać się do sprawy bez jej zamykania.

Z nowym GitHub issues 2.0 możesz użyć tych synonimów, aby odwołać się do sprawy i zamknąć ją (w wiadomości commit):

  • fix #xxx
  • fixes #xxx
  • fixed #xxx
  • close #xxx
  • closes #xxx
  • closed #xxx
  • resolve #xxx
  • resolves #xxx
  • resolved #xxx

Można również zastąpić #xxx z gh-xxx.

Odwołania i zamykanie spraw w repozytoriach działa również:

fixes user/repo#xxx

Sprawdź dokumentację dostępną w sekcji pomocy.

 818
Author: NARKOZ,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2017-02-21 01:21:32

Jeśli chcesz powiązać sprawę z Githubem i zamknąć sprawę, możesz podać następujące linie w wiadomości zatwierdzającej Git:

Closes #1.
Closes GH-1.
Closes gh-1.

(każdy z tych trzech będzie działał.) Zauważ, że spowoduje to powiązanie z problemem, a także zamknie go. Możesz dowiedzieć się więcej w tym blogu (rozpocznij oglądanie osadzonego Wideo około 1:40).

Nie jestem pewien, czy podobna składnia po prostu połączy problem bez zamykania go.

 160
Author: mipadi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2009-11-06 19:12:12

Możesz również odsyłać do repozytoriów:

githubuser/repository#xxx

Xxx to numer Wydania

 60
Author: narkeeso,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-10-10 23:38:34

Github dodaje odniesienie do commita, jeśli zawiera #issuenbr (odkrył to przez przypadek).

 53
Author: Henrik Lindberg,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-04-14 01:32:41

Mają miło pisać o nowych wydaniach 2.0 na swoim blogu https://github.com/blog/831-issues-2-0-the-next-generation

Synonimy to

  • poprawki # xxx
  • Naprawiono # xxx
  • fix # xxx
  • zamyka # xxx
  • Zamknij # xxx
  • zamknięte # xxx

Użycie któregokolwiek ze słów kluczowych w komunikacie zatwierdzającym spowoduje, że Twój commit zostanie wymieniony lub zamknie problem.

 11
Author: xero,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2012-12-20 21:01:13

Jako dodatek do innych odpowiedzi: jeśli nie chcesz nawet napisać Komunikatu o zatwierdzeniu z numerem sprawy i przypadkiem użyjesz Eclipse do rozwoju, możesz zainstalować wtyczki eGit i Mylyn, a także złącze GitHub dla Mylyn. Eclipse może następnie automatycznie śledzić, nad którą sprawą pracujesz i automatycznie wypełnić komunikat commit, w tym numer sprawy, jak pokazano we wszystkich pozostałych odpowiedziach.

Po więcej szczegółów na temat tej konfiguracji zobacz http://wiki.eclipse.org/EGit/GitHub/UserGuide

 4
Author: Bananeweizen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2011-12-26 08:24:10

Jednym z moich pierwszych projektów jako programisty był klejnot o nazwie stagecoach , który (między innymi) pozwalał Automatycznie dodawać numer sprawy z github do każdej wiadomości commit w gałęzi, co jest częścią pytania, na które tak naprawdę nie udzielono odpowiedzi.

Zasadniczo podczas tworzenia gałęzi używasz niestandardowego polecenia (coś w rodzaju stagecoach -b <branch_name> -g <issue_number>), a Numer sprawy zostanie przypisany do tej gałęzi w pliku yml. Był wtedy commit hook , który automatycznie dodała numer sprawy do komunikatu o zatwierdzeniu.

Nie polecałbym go do użytku produkcyjnego, ponieważ w tym czasie programowałem tylko od kilku miesięcy i już go nie utrzymuję, ale może kogoś zainteresować.

 3
Author: omnikron,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2013-04-22 11:38:45

Aby połączyć numer sprawy z Komunikatem o zatwierdzeniu, należy dodać: #issue_number w wiadomości git commit.

Przykładowy komunikat Commit z Udacity git Commit message Style Guide

feat: Summarize changes in around 50 characters or less

More detailed explanatory text, if necessary. Wrap it to about 72
characters or so. In some contexts, the first line is treated as the
subject of the commit and the rest of the text as the body. The
blank line separating the summary from the body is critical (unless
you omit the body entirely); various tools like `log`, `shortlog`
and `rebase` can get confused if you run the two together.

Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how (the code explains that).
Are there side effects or other unintuitive consequenses of this
change? Here's the place to explain them.

Further paragraphs come after blank lines.

 - Bullet points are okay, too

 - Typically a hyphen or asterisk is used for the bullet, preceded
   by a single space, with blank lines in between, but conventions
   vary here

If you use an issue tracker, put references to them at the bottom,
like this:

Resolves: #123
See also: #456, #789

Możesz również odwołać się do repozytoriów:

githubuser/repository#issue_number
 1
Author: Suhas Srivats Subburathinam,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2016-10-20 05:09:48