简体   繁体   中英

How to rebase a branch that has master merged into it?

I've run

git pull origin master 

in my dev-branch to merge master into it. Now

git rebase -i origin/master

says there's merge conflicts that are not real. Incoming change is the 1st commit in the dev-branch (before the merge) and not current situation of the dev-branch.

Current situation of the dev-branch does not have any conflicts with master because master is just merged. The problem is that git thinks there is merge conflicts cause it compares master with old version of the dev-branch. ie 1st commit which in this case is also the commit just before merging master into it.

So how this should be done?

IF you are facing merge conflicts then unless you resolve the conflicts you wont be able to run any git operations unless you resolve the conflicts. merge conflicts will occur if you try to change some files whose remote/master version also has some changes For example you have some changes in abhi.text file and in master branch also abhi.text also has some changes which are not pulled to your local And now you do git pull.....then you face this problem Solution-->>

Before git pull try

git stash

to save the current new changed file and then do

git pull

Now do —>>>

git stash apply

to get the local changes which were stashed and then you may face CONFLICT (content): Merge conflict on specific file then go to Specific files do the changes like….you may get remote changes and local changes in unarranged manner..so just arrange it keep local changes after remote changes

Now do—>>>

git commit and push

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