相关疑难解决方法(0)

git索引包含什么?

Git索引究竟包含什么,以及我可以使用什么命令来查看索引的内容?


更新

谢谢你的所有答案.我知道索引充当临时区域,提交的内容是索引而不是工作树.我只是对索引对象的内容感到好奇.我想它可能是文件名/目录名列表,SHA-1对,也许是一种虚拟树?

在Git术语中,是否有任何可用于列出索引内容的管道命令?

git internal

166
推荐指数
3
解决办法
6万
查看次数

git - 你的分支通过1次提交领先于'origin/master'

我是git的新手,我正在研究git.

我在git中添加了一些文件:

git add <file1>
git add <file2>
Run Code Online (Sandbox Code Playgroud)

然后我想推动审查,但我错了

git commit
Run Code Online (Sandbox Code Playgroud)

所以我改变的文件不用于评论.
现在,如果我输入命令:

git status
Run Code Online (Sandbox Code Playgroud)

它说

# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
nothing to commit (working directory clean)
Run Code Online (Sandbox Code Playgroud)

我想恢复该提交,我想推送这些文件进行审核而不是提交.谁能让我知道我怎么能这样做?

git push commit

96
推荐指数
5
解决办法
21万
查看次数

如何在 2.27+ 中使用 git sparse-checkout

我试图从以下几个教程步骤中重现:

https://github.blog/2020-01-17-bring-your-monorepo-down-to-size-with-sparse-checkout

这是为 git 2.25 制作的,但现在在 2.27 中,运行时什么也没有发生:

$ git sparse-checkout set client/android
Run Code Online (Sandbox Code Playgroud)

我找不到让它工作的方法。

这是一个 MWE:

$ git clone --no-checkout https://github.com/derrickstolee/sparse-checkout-example
Cloning into 'sparse-checkout-example'...

$ cd sparse-checkout-example/

$ git sparse-checkout init --cone
Run Code Online (Sandbox Code Playgroud)

使用 git 2.25,我获得了一个非空目录:

$ ls -a
.  .. bootstrap.sh LICENSE.md  README.md .git
Run Code Online (Sandbox Code Playgroud)

使用 git 2.27,我获得了一个空目录:

$ ls -a
.  .. .git
Run Code Online (Sandbox Code Playgroud)

git

8
推荐指数
1
解决办法
2027
查看次数

标签 统计

git ×3

commit ×1

internal ×1

push ×1