Reputation: 3403
EDIT: I should have noted that these are changes which should already have been merged from the "integration" branch. They somehow did not make it into that merge, and now Git won't add them because it insists the branch is "Already up-to-date". Arrgh.
Git won't update my branch when I try to merge another branch into it.
This file's got differences in another branch, but when I try to merge that branch, Git tells me "Already up-to-date":
$ git diff --stat integration MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp
.../webapp/WEB-INF/jsp/flow/appInfo.jsp | 54 ++++------------------
1 file changed, 10 insertions(+), 44 deletions(-)
$ git merge integration
Already up-to-date.
I'm not really sure how this is possible - can anybody explain how this situation can happen?
Upvotes: 0
Views: 353
Reputation: 24478
When you ask git to merge, it decides what to do based on the shape of the history between the branches. Since git is reporting that it's already up to date, integration
must be an ancestor of HEAD
. You can investigate how this came to be by looking at the output of:
git log --oneline --graph --decorate integration HEAD
If you'd like to replace your local version of that file with the one from the integration
branch, you can do a single-file checkout:
git checkout integration -- MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp
Alternatively, you can do a patch-checkout to view each diff chunk individually and decided whether or not to apply it:
git checkout -p integration -- MyApp/src/main/webapp/WEB-INF/jsp/flow/appInfo.jsp
Upvotes: 2