简体   繁体   中英

Resolving conflicts in GIT for a Pull-request on forked repo

In short, i forked a repo, then created a branch from master, did some coding, pushed branch to origin, created a PR, the PR cannot be merged as it contains conflicts [guessing due to the work of other people]

<<<<<<<
code on master
======
my code
>>>>>>>

I then checked out master, did a pull, checked out my branch, merged master into it, resolved the conflicts, made a commit, pushed the commit, the PR updated with the new commit, the same file still has a conflict like this bellow

<<<<<<<
======
my code
>>>>>>>

Nothing i've tried seems to work, any ideas? Also, what would be the correct way of solving this from the start?

So, just to answer my own question as to what i was doing wrong, might help someone. When a conflict occurs on a pull request , checkout the branch you are merging into, update it, checkout the branch which is being merged, rebase the main branch onto it, resolve any conflicts and push with the -f flag, also it might be good practice to do a interactive rebase to squash all commits and makes the history cleaner.

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