0

I committed and pushed some files via git commit . followed by git push.

Then, I found that there were some mistakes in the files. I fixed ti. Then, I recommitted and re-pushed. So, I now see two separate commits in git log, which is ugly.

Can I merge these two pushed commits into one?

1
  • 1
    In the future, consider using git commit --amend, which amends the previous commit. Then push with git push --force which will overwrite the previous commit. @AdamT's advice on shared repositories still holds. Commented Mar 16, 2013 at 1:25

1 Answer 1

1

Yes you can. If no one else has pulled from the remote you can:

git rebase -i 

Followed by:

git push origin +master 

Please keep in mind that it is not recommended to rebase shared repositores and that +master will ignore it being fast forward.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.