Git索引究竟包含什么,以及我可以使用什么命令来查看索引的内容?
更新
谢谢你的所有答案.我知道索引充当临时区域,提交的内容是索引而不是工作树.我只是对索引对象的内容感到好奇.我想它可能是文件名/目录名列表,SHA-1对,也许是一种虚拟树?
在Git术语中,是否有任何可用于列出索引内容的管道命令?
如何使用bash脚本遍历存储库中的所有本地分支.我需要迭代并检查分支和一些远程分支之间是否有任何区别.防爆
for branch in $(git branch);
do
git log --oneline $branch ^remotes/origin/master;
done
Run Code Online (Sandbox Code Playgroud)
我需要做上面给出的事情,但我面临的问题是$(git branch)给了我存储库文件夹中的文件夹以及存储库中存在的分支.
这是解决此问题的正确方法吗?或者还有另一种方法吗?
谢谢
我有一个项目与某些js文件,我无法更新.我在本地运行OSX,而我的远程/临时服务器是Linux(CentOS).
在本地克隆我的项目后,我注意到我有所有那些具有git状态的文件modified.我从来没有修改它们,所以我尝试了discard changes或者reset它们,但它们再次出现.修改中的更改是删除所有行并再次添加它们.
我不确定为什么会发生这种情况或如何解决它,以便我的git状态是干净的,因为它需要.
以下是git状态的几行:
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/el.js
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/fa.js
# modified: app/webroot/js/ckeditor/plugins/devtools/lang/gu.js
Run Code Online (Sandbox Code Playgroud)
更新1:
我现在设法提交上述文件,但登台服务器被锁定,因为它不会提取新的编辑:
error: Your local changes to the following files would be overwritten by merge:
app/webroot/js/ckeditor/_source/lang/ar.js
app/webroot/js/ckeditor/_source/lang/bg.js
app/webroot/js/ckeditor/_source/lang/bn.js
app/webroot/js/ckeditor/_source/lang/cs.js
...
Aborting
Run Code Online (Sandbox Code Playgroud)
我无法提交/推送,因为:
Updates were rejected because a pushed branch tip is behind its remote counterpart
Run Code Online (Sandbox Code Playgroud)
我试过了:
git reset --hard
Run Code Online (Sandbox Code Playgroud)
和
git stash
git stash drop
Run Code Online (Sandbox Code Playgroud)
但它们不起作用,没有任何反应.
更新2:
git diff 给我:
The file will have its original line endings in your …Run Code Online (Sandbox Code Playgroud)