繁体   English   中英

VSCode & Git 问题:无法撤消,因为 HEAD 没有指向任何提交

[英]VSCode & Git problem : Can't undo because HEAD doesn't point to any commit

我在使用 VSCode 时遇到问题,当我想撤消上次提交时,弹出消息是“无法撤消,因为 HEAD 没有指向任何提交。”

但是我已经在 shell 中手动提交并工作了。

最后登录“输出”window:

> git status -z -u
> git symbolic-ref --short HEAD
> git for-each-ref --format=%(refname)%00%(upstream:short)%00%(upstream:track)%00%(objectname) refs/heads/master refs/remotes/master
fatal: unknown upstream: format track

git 状态:

[DEV - -@- -]$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#   (use "git push" to publish your local commits)
#
# 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:   ---
#       modified:   ---
#       modified:   ---
#       modified:   ---
#
no changes added to commit (use "git add" and/or "git commit -a")

图片 VSCode:如您所见,当我在 VSCode 中提交时,同步按钮不显示更改

你能帮我修一下 git 吗?

我回答自己,我有 git 1.x。 我切换到 git 2.x 并且我所有的问题都消失了,奇怪的是 VSCode 没有警告 git 1.x 可能存在错误

这对我有用。

在 vs 代码类型git push并完成。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM