1

IM getting this error message that says syncing has failed. I looked around for solutions and found that git status would give some idea about the problem. So I did it and got this:

    # On branch dev_0.9_HUD_development
# Your branch is behind 'origin/dev_0.9_HUD_development' by 1 commit, and can be
 fast-forwarded.
#   (use "git pull" to update your local branch)
#
# 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:   res/models/hud/HUD2.png
#       modified:   src/Weapon/Laser.java
#       modified:   src/Weapon/Weapon.java
#       modified:   src/game/world/gui/hud/HeadsUpDisplay.java
#       modified:   src/game/world/gui/hud/ShipStat.java
#       modified:   src/game/world/gui/hud/WeaponDisplay.java
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       src/hero101.mtl
#       src/hero101.obj

There were many solutions but none of them seem to work. I tried restarting computer. Nothing happened. I tried git checkout but it gives another error. I tried merging the branches still get the same error. What can I do to fix this?

micstr
  • 5,080
  • 8
  • 48
  • 76
Marko Taht
  • 1,448
  • 1
  • 20
  • 40
  • 1
    you have uncommitted changes. maybe you want to commit them? – Eevee Mar 28 '14 at 19:53
  • In eclipse when i try to commit it say that nothing has been changed. I have already commited in eclipse, and i want to sync git so that i could accses these changes elswhere. And in the git thingi i can commit either. – Marko Taht Mar 28 '14 at 21:57
  • maybe commit from the command line, then, because you very clearly have changes. most likely the errors from checkout and merge are also trying to tell you this, and explicitly suggest you commit (or stash). – Eevee Mar 28 '14 at 22:11

2 Answers2

1

If your branch is behind an upstream remote branch, that means you haven't done any commit.

In command line:

cd /patH/to/your/repo
git stash
git pull
git stash pop
git add -A
git commit -m "My work"
git push

That assumes that all the files listed by your current git status are modified files that you want to version.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 0 !]> git stash fatal: Unable to create 'C:/Users/Marko/Documents/GitHub/Over-The-Galaxy/.git/in dex.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. Cannot save the current index state – Marko Taht Mar 29 '14 at 09:48
  • @user3071712 try closing Eclipse first. If the issue persists, try to delete the `index.lock`, or... http://stackoverflow.com/a/18920089/6309 ;) – VonC Mar 29 '14 at 09:49
0

Ok. So i looked into the .git folder in the repo. I changed the name of index.lock file, after that i did the git stash and git pull and everything worked.

Marko Taht
  • 1,448
  • 1
  • 20
  • 40