Ivan Zamylin
Ivan Zamylin

Reputation: 1748

Don't include merge conflict commit into git push

When I resolve a conflict, I have a merge commit in addition to the "real commit" I've made. It looks as following:

Merge branch 'master' of http://myDomain.com/git/SIMULATOR

What is the best way to squash it into my "real commit", so that I have only one commit when pushing it to the server?

Upvotes: 1

Views: 186

Answers (2)

user4815162342
user4815162342

Reputation: 155236

If have an existing merge commit, you can use git rebase, as answered by defuz—but then you will have to resolve the conflicts again.

Otherwise, use git merge --squash to squash changes introduced by the merge into a single commit. Resolve the conflicts if any, and run git commit.

Upvotes: 1

defuz
defuz

Reputation: 27611

git fetch origin
git rebase master origin/master
git push origin master

PS. Read man git-rebase

Upvotes: 1

Related Questions