Marko Taht
Marko Taht

Reputation: 1522

GitHub Failed to sync this branch

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?

Upvotes: 1

Views: 3347

Answers (2)

Marko Taht
Marko Taht

Reputation: 1522

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.

Upvotes: 0

VonC
VonC

Reputation: 1323263

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.

Upvotes: 1

Related Questions