IM收到此错误消息,表示同步失败。我四处寻找解决方案,发现git status
会对问题有所了解。所以我做到了并得到了这个:
# 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
有许多解决方案,但它们似乎都没有效果。我试过重启电脑。没啥事儿。我尝试了git checkout,但它给出了另一个错误。我尝试合并分支仍然得到相同的错误。我该怎么做才能解决这个问题?
答案 0 :(得分:1)
如果你的分支在上游远程分支后面,那意味着你没有做任何提交。
在命令行中:
cd /patH/to/your/repo
git stash
git pull
git stash pop
git add -A
git commit -m "My work"
git push
这假设您当前的git状态列出的所有文件都是您想要版本的修改过的文件。
答案 1 :(得分:0)
确定。所以我查看了repo中的.git文件夹。我更改了index.lock文件的名称,之后我执行了git stash和git pull,一切正常。