Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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/AllConstants.java

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/project.properties
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/CreateBatchFragment.java
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/CreatePlaceActivity.java
        modified:   client/android/Devalt/src/com/RareMediaCompany/Devalt/Tasks/DownloadTask.java
        modified:   client/android/DevaltGithubStaging/project.properties
        modified:   client/android/DevaltTaraAkshar/DevaltGithub/project.properties
        modified:   client/android/TaraMachines/src/com/RareMediaCompany/TaraMachines/Dataclasses/AllConstants.java

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

like image 503
Sangeeta Avatar asked Apr 09 '15 17:04

Sangeeta


1 Answers

Git is informing you that you are doing a merge and that your branch and the origin branch have diverged.

  • A merge conflict - someone has updated code that you have updated
  • Divergence - the tip of your branch is different than the tip of the remote branch

You want to talk to the developer who committed to master to see how to resolve this, since origin/master may contain important work that shouldn't be lost in this merge conflict.

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.

like image 76
tupini07 Avatar answered Sep 17 '22 20:09

tupini07