Editing the git commit message in GitHub
Is there any way of online editing the commit message in GitHub.com
, after submission?
From the command line, one can do
git commit --amend -m "New commit message"
as correctly suggested in another question.
Trying git pull
and then git push
has worked (without any other commit having interfered in the mean time).
But can it be done via the GitHub
website?
GitHub's instructions for doing this:
- On the command line, navigate to the repository that contains the commit you want to amend.
- Type
git commit --amend
and press Enter. - In your text editor, edit the commit message and save the commit.
- Use the
git push --force example-branch
command to force push over the old commit.
Source: https://help.github.com/articles/changing-a-commit-message/
No, this is not directly possible. The hash for every Git commit is also calculated based on the commit message. When you change the commit message, you change the commit hash. If you want to push that commit, you have to force that push (git push -f). But if already someone pulled your old commit and started a work based on that commit, they would have to rebase their work onto your new commit.