1

I'm new to git, and have two branches i'm trying to merge (newDevelopment and master). I messed up the file tracking somehow on my newDevelopment branch, and because so, I cannot merge the changes into master. I've tried renaming the branch and merging to no avail.

Here's what i'm looking at:

blabla@ip:/vol/apps/staging/current$ git diff --name-status newDevelopment..master
M       app/admin/reports.rb
M       config/resque_schedule.yml

blabla@ip:/vol/apps/staging/current$ git branch
MoreDetailsReport
* master
newDevelopment

blabla@ip:/vol/apps/staging/current$ git merge newDevelopment
Already up-to-date.

How do I fix this? Thanks!

janos
  • 120,954
  • 29
  • 226
  • 236
seanriordan08
  • 296
  • 3
  • 14
  • Perhaps this answer can help: http://stackoverflow.com/questions/634546/git-merge-reports-already-up-to-date-though-there-is-a-difference?rq=1 – ArtemB May 21 '14 at 20:10

1 Answers1

2

It looks like that you have already merged newDevelopment into master, and when you did it, you ignored some changes (reset them) and committed the merge. As a result, master has all revisions from newDevelopment, and so there's nothing more to merge into it. But the branches are different, because of the changes you ignored.

One way to fix is to make a copy of your branch for backup, then reset its history to the point before you messed things up:

git branch master-bak
git reset --hard SHA1

Find the right SHA1 using git log, probably it's a merge commit. After that, repeat the merge that went wrong.

Another, not so good way to fix is to get those files with the changes from the other branch:

git checkout newDevelopment -- app/admin/reports.rb
git checkout newDevelopment -- config/resque_schedule.yml

And then use git diff --cached to review the differences.

janos
  • 120,954
  • 29
  • 226
  • 236