简体   繁体   中英

merge conflict with pull request

I'm new git! I try contributing to a project user2:master, and make a pull request. Then I needed to fix something, so I did. I made the change, push to my master branch user1:master. So now, 2 commits are seating in the pull request. user2 wants to merge my commits, but there's a merge conflict. How do can I merge these conflicts? (I think theres a conflict between the first and second commit). Thank you in advance

Difficult to say for sure without knowing more about the conflict, but the most likely reason that user2 is running into a merge conflict is he/she made some change which conflicts with your change after your last pull of the upstream (user2) repo.

The usual way to deal with this, assuming the other user hasn't merged your pull request yet is:

  1. Rebase your changes on top of the latest in user2:master, eg git fetch user2; git rebase user2/master git fetch user2; git rebase user2/master
  2. This will likely cause a merge conflict. Resolve the conflict in the indicated files, test, then do git add <those files>; git rebase --continue git add <those files>; git rebase --continue
  3. Finally, carefully push your newly rebased commits back to your remote branch to update the pull request (you'll have to use --force, since you've technically rewritten those commits, so make sure only to do this if the other user has not merged your request yet) git push user1 master --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM