VSCode 和 Git 问题:无法撤消,因为 HEAD 未指向任何提交

问题描述

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

但是我已经在 shell 中提交并手动完成了。

最后登录输出”窗口:

> 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:As you can see,when I commit in VSCode,the synchronize button doesn't show changes

你能帮我修复 git 吗?

解决方法

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

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...