I did a git commit and pushed to github, but forgot to mention the issue number in the commit (I forgot to write something like ... closes #123
).
If I had mentioned the issue number in the commit message, github would have connected the commit to the issue. Is there any way to do this after the commit, when it's too late for me to change the commit message?
EDIT: Assume that it's too late to amend the commit or otherwise alter the history. I am really asking about github functionality, not git.
You just need to include #xxx in your commit message to reference an issue without closing it. With the new GitHub issues 2.0, you can use these synonyms to reference an issue and close it (in your commit message).
To link related issues in the same repository, you can type # followed by part of the issue title and then clicking the issue that you want to link. To communicate responsibility, you can assign issues. If you find yourself frequently typing the same comment, you can use saved replies.
Add and commit changes These two commands make up the bulk of many workflows that use git for version control. Modified files are staged using git add, and following a commit, all files in the staging area are snapshotted and become part of the repository's history, receiving a unique SHA-1 hash identifier.
In your issue on GitHub, just write a comment with the commit hash. For instance:
Fixed with commit 61d949320fc0bf1a8dba09b3845bddcd153b1a64
GitHub will recognize it as a SHA and link to the right commit page.
The Github help page "Can I delete a commit message?" explain how to alter:
But since it changes the history, you need to make anyone having already pulled from the GitHub repo aware of that change.
If rewriting the history isn't possible, you can make a new commit, with a commit message including:
GitHub will automatically link that old commit in your new commit message: see for istance the reference to commit cdfd948 in this git commit.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With