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
Share:
29,532

Related videos on Youtube

NI6
Author by

NI6

Updated on January 14, 2021

Comments

  • NI6
    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
      Frodon over 7 years
      The problem is for the merge operation of your branch onto master (I guess). you should first merge origin/master into your branch and solve the conflict (apparently a file you modified was moved in master branch). Once solved, commit and push your branch again and reopen your pull request.
    • NI6
      NI6 over 7 years
      I tried, but it also says already up to date
    • Frodon
      Frodon over 7 years
      Did you run git fetch ?
    • NI6
      NI6 over 7 years
      Yes, but unfortunately it changed nothing
    • Vitalliuss
      Vitalliuss over 7 years
      Can you share the result of "git status" operation for your repository?
  • Suncat2000
    Suncat2000 over 5 years
    After 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
    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
    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
    Scott Anderson about 3 years
    @Suncar2000 On the contrary, git is exceptionally clever, you just have to be on your toes