Conflict on bitbucket remote server but everything is up to date locally
29,532
You need to update your local master branch. Do the following steps:
git checkout master
git pull origin master
git checkout << your branch >>
git merge master
After you execute the 4th command, you will get merge conflicts. Resolve them and then do:
git commit
Related videos on Youtube
Author by
NI6
Updated on January 14, 2021Comments
-
NI6 over 3 years
I'm working on a project, so I pushed a feature branch to the remote repository(using Atlassian bitbucket) and opened a pull request.
But on one file, the bitbucket diplay a "MOVED" status, in brown and shows a conflict message :
conflict: modified on source, modified in target.
this file is in a conflicted state. You will need to resolve the conflict manually before you can merge this pull request.
So when I typed:
git pull origin my_feature
I get the message
Already up-to-date.
How can I resolve this conflict?
-
Frodon over 7 yearsThe problem is for the
merge
operation of your branch ontomaster
(I guess). you should first mergeorigin/master
into your branch and solve the conflict (apparently a file you modified was moved inmaster
branch). Once solved, commit and push your branch again and reopen your pull request. -
NI6 over 7 yearsI tried, but it also says already up to date
-
Frodon over 7 yearsDid you run
git fetch
? -
NI6 over 7 yearsYes, but unfortunately it changed nothing
-
Vitalliuss over 7 yearsCan you share the result of "git status" operation for your repository?
-
-
Suncat2000 over 5 yearsAfter working with git a while, I now understood what happened. Git pull doesn't pull commits to the whole repository, just the branch your'e using. To merge with another branch, you have to check out that branch and pull it, too. Then both will be up to date and a merge will work as expected, conflicts and all. Git is a stupid git.
-
AlexJ over 4 years@Suncat2000 It would be terrible if git pulled every branch on
git pull
. You could end up merging branches you're not yet ready to merge. -
Anu about 4 years@AlexJ, So a good practice before making a pull-request(or even before committing & pushing your changes to your branch) would be to 1. checkout the master branch and fetch it(so that you get all the changes ) 2. switch to dev branch and fetch it, not you can see what changes other developer did which you wanna keep. 3. commit/push your changes to remote->dev and 4. git merge master.
-
Scott Anderson about 3 years@Suncar2000 On the contrary, git is exceptionally clever, you just have to be on your toes