zed
zed

Reputation: 3287

Git: Commit an unresolved conflict

My colleague is kind of new to git. He was working on a project without ever pulling for two weeks. Now he pulled my work and he has got lots of conflicts.

Can he push the work back to me so I'd resolve the conflicts and push back to him?

Objective: Committing an unresolved conflict, and pushing it.

Upvotes: 2

Views: 7578

Answers (1)

danvalencia
danvalencia

Reputation: 261

Assuming both of you are working on the same branch, say master, your friend could create a separate branch, and push it to a remote, like so:

git checkout -b conflict-branch
git push origin conflict-branch:conflict-branch

At that point you can pull from the remote repo and checkout the conflict branch:

git pull origin
git checkout -b conflict-branch origin/conflict-branch

Now you have your friends code locally and you could try to do a local merge to master:

git checkout master
git merge conflict-branch

At this point you should be able to fix merge conflicts, and push your changes back to the remote.

Hope this helps.

Upvotes: 3

Related Questions