1

I get "Already up-to-date" messages when trying to merge one branch, 'feature_1', into another, 'release_1', more than once where changes have been committed to feature_1 in between merges. That is, I have something like:

# Developer 1: create feature_1 branch with initial commit
git checkout -b feature_1 origin/master
git commit -am "Initial commit."
git push origin feature_1

# Developer 2: create release_1 branch and merge feature_1 into it
git checkout -b release_1 origin/master
git merge origin/feature_1
# success
git push origin release_1

# Developer 1: make change to feature_1
git checkout feature_1
git commit -am "Fixed issue."
git push origin feature_1

# Developer 2: attempt to get latest state of feature_1 merged into release_1
git checkout release_1
git merge origin/feature_1

Already up-to-date 

From reading related questions ( Git merge reports "Already up-to-date" though there is a difference and Git merge confusion. Diff shows differences, and merge says there are none ) I understand that this indicates that feature_1 is an ancestor of release_1. What I haven't found yet is how to merge/fast-forward the latest commits from feature_1 into release_1 that second time.

From comments in the first question linked above I've tried the following while in release_1:

git reset --hard origin/feature_1

This essentially resets release_1 so that it's identical to the latest state of feature_1 rather than merging the latest state of both branches together, so that's not what I'm looking for.

How can I merge the latest commits from feature_1 into release_1 if feature_1 is an ancestor of release_1? I thought 'git merge' would do a fast forward. I wonder if I'm missing a 'git pull' or something and the fast forward is not seeing the latest commit on the origin. Or if there's some other command/step I haven't found yet. Basically, am I using the correct approach and I'm just missing something (or maybe msysgit has bug) or am I using the wrong approach altogether?

Thanks for your help.

Community
  • 1
  • 1
jlpp
  • 1,564
  • 5
  • 23
  • 36

1 Answers1

2

Developer 2 needs to do a git pull or fetch on feature_1. As far as his repository is concerned, feature_1 hasn't changed since the last time it was merged.

Karl Bielefeldt
  • 47,314
  • 10
  • 60
  • 94
  • git pull did the trick. I think I was inadvertently skipping that step thinking that the reference to origin/feature_1 would "see" the latest commits on the origin repository. Thanks! – jlpp Jul 12 '11 at 14:00