JavaEar 专注于收集分享传播有价值的技术资料

Your branch and 'origin/master' have diverged, All conflicts fixed but you are still merging

i am new to GitHub. and using it via Eclipse we are two people working on a application. i am getting following status when i check git status in Git shell.

On branch master
Your branch and 'origin/master' have diverged,
and have 2 and 1 different commit each, respectively.
  (use "git pull" to merge the remote branch into yours)

All conflicts fixed but you are still merging.
  (use "git commit" to conclude merge)

Changes to be committed:

        deleted:    client/android/BlueDolphinCore/bin/AndroidManifest.xml
        deleted:    client/android/BlueDolphinCore/bin/R.txt
        deleted:    client/android/BlueDolphinCore/bin/bluedolphincore.jar
        deleted:    client/android/BlueDolphinCore/bin/jarlist.cache
        deleted:    client/android/ChitrguptVersion2/bin/AndroidManifest.xml
        deleted:    client/android/ChitrguptVersion2/bin/R.txt
        deleted:    client/android/ChitrguptVersion2/bin/chitrguptversion2.jar
        deleted:    client/android/ChitrguptVersion2/bin/jarlist.cache
        modified:   client/android/TaraMachines/AndroidManifest.xml
        modified:   client/android/TaraMachines/src/com/RareMediaCompany/TaraMachines/Dataclasses/

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   client/android/BlueDolphinCore/gen/.gitignore
        modified:   client/android/Devalt/.classpath
        modified:   client/android/Devalt/
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/Tasks/
        modified:   client/android/DevaltGithubStaging/
        modified:   client/android/DevaltTaraAkshar/DevaltGithub/
        modified:   client/android/TaraMachines/src/com/RareMediaCompany/TaraMachines/Dataclasses/

I want to commit my code and sync. but Git is not letting me do so. i have Gitignore file too. but still it is asking me to commit bin and gen folder.

what should i do to ignore these files and sync my workspace. and why i am getting this issue. please explain. Thank you


  1. Git is informing you that you are doing a merge and that your branch and the origin branch have diverged. @Makoto gave a good description of what this means in a comment of the question. To solve this you need to:

    • Solve your merge: fix every merge issue

    • Make a git pull to download the newer code from origin to your local repository.

    To finish the merge you have to execute git commit. This just lets git know that you have fixed every conflict.

    Now, to ignore the files you need to put their names in the .gitignore. If you put them there now then you'll notice that they are not being ignored. This is because Git is already tracking the files and the .gitignore only ignores files that are not already being tracked. To fix this you can do:

    git rm --cached .
    git add .

    The git rm --cached . removes everything from tracking and git add . adds everything again EXCEPT the things that are specified in you .gitignore.

    NOTE: You do not need to remove everything from tracking, if you want you can manually specify which files to remove from tracking by changing the . with the name of the file you want to change. If you do this then it's not necessary to add everything again.