1

I was updating the master branch on a project. So I checked out my feature branch feature/branch-A and merged master into it after making sure master was up to date with origin. I then checked out master and merged feature/branch-A into master.

The issue is the feature/branch-A was created from master commit A(a past version of master) whereas the master branch is now at commit C because other work from featire/branch-B has been merged to that branch. commit C on the master branch has files from commit A which have been modified and renamed. when I merge master into feature/branch-A instead of those files overwriting the commit A history in the feature/branch-A I get the opposite (the files do not reflect the master branch at this point in history which is commit c). So I now have feature/branch-A that I believe has been updated with a merge from master but in reality the content from master has failed to update on the feature/branch-A. Now when I checkout master and merge feature/branch-A, the content of master is modified to reflect 'commit A' plus changes from feature/branch-A instead of having the current version of master which is commit C.

I thought that merging master into feature/branch-A while having the feature checked out would up date the branch to represent the current version, commit c, of the master.

My question is why is this behavior occurring?

Xochi
  • 59
  • 1
  • 1
  • 9
  • 1
    Maybe something helpful here: https://stackoverflow.com/questions/14894768/in-git-how-is-fetch-different-than-pull-and-how-is-merge-different-than-rebase – GaTechThomas Nov 30 '17 at 03:11
  • The feature branch was created from a past version of the master branch which is a commit from 24 days ago. Master in its current version has files from 24 days ago that have been renamed and some files that have changed but when I have merged the feature into master the version of those files has reverted to what they were like when the branch was first created. When a merge happens from master to feature, shouldn't the master branch override the changes on the feature? – Xochi Nov 30 '17 at 03:38

1 Answers1

1

Don't know what you mean exactly by "an old version of the master branch has appeared after the merge". If you want to take a look at your current git status, I recommend using gitk

gitk --all & # For Bash shell

gitk --all   # For Windows powershell

This will give u a convenient GUI to check the following things:

  • Check if the merge is completed;
  • Check if remote branch is also updated;
  • Check if you are currently on the right branch and commit;
guoguo616
  • 11
  • 3