Reputation: 3434
I accidently commit my source code to git repository with incomplete commit message and pushed the code. Now I want to edit the commit message that I have pushed. i know that we can edit a commit message before it is pushing. But i pushed the code also. Is there any way to edit the message???
Upvotes: 2
Views: 381
Reputation: 4503
See Edit an incorrect commit message in Git that has already been pushed.
git commit --amend
will let you edit the commit message, and git push --force
will rewrite your remote repository. As others have noted, rewriting your remote is a terrible idea if you have anyone downstream (i.e. if anyone else pulls from your remote).
Upvotes: 5
Reputation: 1660
In general you should not do this, unless it is an option to correct reference in target repository and in all repositories used by your peer developers. If so, you could just change commit in your own repository, push new commit, reset branch in target repository to point new commit and ask everyone else to rebase.
Upvotes: 4