最后一次提交,HEAD和我在目录中可以看到的文件状态之间似乎有区别.
什么是HEAD,我该怎么办?我应该避免哪些错误?
嗨,我需要像这样合并两个分支.
这只是一个正在发生的事情的例子,我使用了数百个需要解决的文件.
git merge branch1
...conflicts...
git status
....
# Unmerged paths:
# (use "git add/rm <file>..." as appropriate to mark resolution)
#
# both added: file1
# both added: file2
# both added: file3
# both added: file4
git checkout --ours file1
git chechout --theirs file2
git checkout --ours file3
git chechout --theirs file4
git commit -a -m "this should work"
U file1
fatal: 'commit' is not possible because you have unmerged files.
Please, fix them up in the …
Run Code Online (Sandbox Code Playgroud) 使用公共仓库,我想让我的主分支回到过去的某个提交.我已经查看了选项,对我来说最好的事情看起来是对所需提交的简单检查,然后提交到主分支.但是,当我执行检出时,它不会删除在指定的提交哈希之后添加到master中的某些文件.
例如,如果我想回到提交aaa1
:
$ cd working-copy-top-dir
$ git checkout master
$ git checkout -- .
$ git clean -fd
$ git checkout aaa1 .
$ git clean -fd
Run Code Online (Sandbox Code Playgroud)
但此时添加的一些文件aaa1
仍在工作副本中.什么是checkout
命令来获得工作拷贝数据回来是怎么回事的aaa1
?
$ git --version
git version 2.7.2.windows.1
Run Code Online (Sandbox Code Playgroud) git reset --hard head
vsgit clean --force -d
与git checkout -- .
然后git pull
丢弃本地更改并从 Git 服务器存储库获取最新版本之间有什么区别?
根据我的理解 git diff
,用于比较工作目录和暂存区域之间的文件。但是,如果我在暂存区域中没有暂存更改,则相同的命令git diff
会比较工作目录和 HEAD 之间的文件。
为什么同一个命令 ( git diff
) 给出两个不同的输出?
我实际上如何区分工作目录和暂存区域?