Git merge branch already up to date, yet has modifications pending

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!

  • Missing some variable declaration in java file when git Merge with another branch
  • git merge prompt “fatal: empty ident”
  • Check if a PR is up to date with the target branch
  • Merge code between two dfferent git repositories
  • How merge (or rebase) two branches to develop in special situation
  • Merging: Hg/Git vs. SVN
  • Is it better to use a separate commit message for a git merge?
  • Cannot rebase git, merge and Gerrit
  • One Solution collect form web for “Git merge branch already up to date, yet has modifications pending”

    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.

    Git Baby is a git and github fan, let's start git clone.