Search code examples
gitversion-controlgit-mergebranching-and-merging

Git merge "Already up to date"


enter image description hereI have a master branch and then I have 3 other branches A, B, C. I am trying to merge A into Master via

 git merge A

I get Already up to date

I guess that means A is based off master. But then how do I get the code changes in A into Master?


Solution

  • The message “Already up-to-date” means that all the changes from the branch you’re trying to merge have already been merged to the branch you’re currently on. More specifically it means that the branch you’re trying to merge is a parent of your current branch.

    Using a graphical tools of git look at your repository. The label for the “A” branch should be somewhere below your “master” branch label.

    Your branch is up-to-date with respect to its parent. According to merge there are no new changes in the parent since the last merge. That does not mean the branches are the same, because you can have plenty of changes in your working branch and it sounds like you do.

    One solution to remediate the problem is:

    git checkout master
    git reset --hard A
    

    This brings it back to the 'A' level.

    Then do:

    git push --force origin master
    

    in order to force changes back to the central repo.