相关疑难解决方法(0)

如何取消本地git提交

我的问题是我已经更改了一个文件,例如:README,为我的测试行添加了一行新的'并保存了该文件,然后我发出了以下命令

 git status

 # On branch master
 # Changed but not updated:
 #   (use "git add <file>..." to update what will be committed)
 #   (use "git checkout -- <file>..." to discard changes in working directory)
 #
 #  modified:   README
 #
 no changes added to commit (use "git add" and/or "git commit -a")


 git add README

 git commit -a -m 'To add new line to readme'
Run Code Online (Sandbox Code Playgroud)

我没有将代码推送到github,现在我想取消这个提交.

为此我用过

   git reset --hard HEAD~1
Run Code Online (Sandbox Code Playgroud)

但是我从README文件中丢失了新添加的" 这个用于我的测试行 ".这不应该发生.我需要内容.有没有办法保留内容并取消我的本地提交?

git git-reset git-commit

696
推荐指数
6
解决办法
73万
查看次数

在Visual Studio代码中如何在两个本地分支之间合并?

在Visual Studio Code中,我似乎只允许推送,拉取和同步.有文档支持合并冲突,但我无法弄清楚如何在两个分支之间实际合并.VSC中的Git命令行(按F1键)仅显示命令的子集:

VSCode中提供的eGit选项

尝试从备用分支或推送到备用分支会产生:

git命令限制

这是VSCode的Git Visual Studio Code Git文档的文档

我在俯瞰什么?

git visual-studio-code

79
推荐指数
5
解决办法
6万
查看次数

标签 统计

git ×2

git-commit ×1

git-reset ×1

visual-studio-code ×1