2

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???

2
  • 3
    You can. But doing so will create problems for anyone referencing the public revision. Commented Jun 4, 2012 at 12:43
  • possible duplicate of How do I edit an incorrect push message in Git? Commented Jun 6, 2012 at 14:08

2 Answers 2

5

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).

Sign up to request clarification or add additional context in comments.

Comments

4

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.