当我这样做时,git diff COMMIT我看到了提交和HEAD之间的变化(据我所知),但我希望看到单个提交所做的更改.
我没有在diff/log上找到任何明显的选项,它会给我输出.
Git索引究竟包含什么,以及我可以使用什么命令来查看索引的内容?
更新
谢谢你的所有答案.我知道索引充当临时区域,提交的内容是索引而不是工作树.我只是对索引对象的内容感到好奇.我想它可能是文件名/目录名列表,SHA-1对,也许是一种虚拟树?
在Git术语中,是否有任何可用于列出索引内容的管道命令?
Git中commit-ish和tree-ish的具体示例是什么?
Stack Overflow问题"git中树是什么意思?" 特别是涉及树,但我想更多地了解这两者.
Git文档对"commit-ish"和"tree-ish"进行了多次引用.例如,如果您正在检查Git源代码:
$ git grep --files-with-matches --extended-regexp "commit(-)*ish"
config.txt
git-describe.txt
git-fast-import.txt
git-name-rev.txt
git-push.txt
git-rebase.txt
git-rev-parse.txt
git.txt
gitcli.txt
glossary-content.txt
howto/revert-branch-rebase.txt
revisions.txt
Run Code Online (Sandbox Code Playgroud)
和
$ git grep --files-with-matches --extended-regexp "tree(-)*ish" | \
$ grep --invert-match RelNotes
diff-format.txt
diff-generate-patch.txt
git-archive.txt
git-cat-file.txt
git-checkout.txt
git-diff-index.txt
git-diff-tree.txt
git-ls-files.txt
git-ls-tree.txt
git-merge-tree.txt
git-read-tree.txt
git-reset.txt
git-svn.txt
git.txt
gitcli.txt
gittutorial-2.txt
glossary-content.txt
revisions.txt
Run Code Online (Sandbox Code Playgroud)
Git文档定义了"commit-ish"和"tree-ish"是什么:
Run Code Online (Sandbox Code Playgroud)<tree>表示树对象名称.
Run Code Online (Sandbox Code Playgroud)<commit>表示提交对象名称.
Run Code Online (Sandbox Code Playgroud)<tree-ish>表示树,提交或标记对象名称.采用一个的命令
<tree-ish>参数最终想要一个上操作<tree>对象,但自动取消引用<commit>和<tag> …
我已经阅读并尝试了很多Git命令建议和讨论,现在持续了好几天.似乎没有简单,全面的方法来使远程Git repo完全变空 - 没有分支,没有引用,没有对象,没有文件,没有任何东西.
是的,我认识到可以删除并重新创建回购 - 如果一个人对原点有这种权限(我没有),但这不是重点.怎么做?Git命令的哪些组合实际上会做到这一点,让处于处女状态的repo准备接收我们希望推入它的任何东西,并且基本上没有大小(或者处女回购的最小尺寸)?
请不要告诉我不应该这样做,或者我们必须通知所有用户等.我知道这一切. 我只是想彻底开始.
我团队中的其他人创建了一个新的git分支,提交并推送到我们使用的常用遥控器.当我试图查看这个分支时,我得到了这个:
% git checkout 12382
fatal: Cannot switch branch to a non-commit '12382'
Run Code Online (Sandbox Code Playgroud)
我没有遇到从这个存储库中检出其他分支的麻烦; 尝试在此之后检查另一个(一个我没有本地副本),它工作正常.
我尝试在Go管道上使用此分支构建服务器,它工作正常 - 这意味着服务器成功检出了该分支.
试过这个以检查事物的状态:
% git remote show origin
* remote origin
Fetch URL: git@gitlab.mycompany.com:mycompany/myrepository.git
Push URL: git@gitlab.mycompany.com:mycompany/myrepository.git
HEAD branch: stage
Remote branches:
10112 tracked
10198 tracked
10678 tracked
...
12382 tracked <<<---
...
Local branches configured for 'git pull':
...
Local refs configured for 'git push':
...
Run Code Online (Sandbox Code Playgroud)
谁能建议如何解决这个问题?什么地方出了错?
比方说,如果从master分支机构,我们创建一个foo分支和一个bar分支.
git checkout -b foo master
git checkout -b bar master
Run Code Online (Sandbox Code Playgroud)
现在让我们说,如果我们创建一个分支wah基础上foo,bar或master:
git checkout -b wah foo
Run Code Online (Sandbox Code Playgroud)
要么
git checkout -b wah bar
Run Code Online (Sandbox Code Playgroud)
要么
git checkout -b wah master
Run Code Online (Sandbox Code Playgroud)
然后在那里是否有任何的不同wah是基于foo,bar或master?有没有可以告诉它是基于任何Git命令foo,bar或master?
我正在编写一个用于验证url的钩子,它在git log的notes部分输入.我遍历每个提交以获取该特定提交的注释,并对该URL进行字符串比较.如果提交是新提交,则会弹出问题,因为新提交不包含注释.
例:-
git add sample
git commit -m "added sample"
git notes add -m "sample note" <commitID-of-sample>
git push origin master
git push origin refs/notes/*
Run Code Online (Sandbox Code Playgroud)
上面例子的问题是,首先我推送提交但是提交没有注释,因为git push origin refs/notes/*在master之后被推送.我基本上想要在预接收挂钩中访问提交的注释.
有什么建议?
我只是在一个项目中尝试了一些东西,并想删除一些我正在使用但不再需要的修改过的文件。
我粗心大意,打字git checkout file而不是git checkout -- file. 所以基本上我只是检查这个修改后的文件,我不知道修改后的文件去了哪里。
我试过使用git update-index --fresh只是想看看这个修改过的文件可能去了哪里,但它似乎最终可能被删除了?
modified: test/ssc_test/cmod_tcsdirect_steam_test.cpp
modified: test/ssc_test/cmod_tcsfresnel_molten_salt_test.cpp
modified: test/ssc_test/cmod_tcsmolten_salt_test.cpp
Run Code Online (Sandbox Code Playgroud)
这些是我试图摆脱但忘记添加--以摆脱其中一个编辑过的文件的文件。
签出此文件后,它没有删除它,而是给了我消息,Updated 1 path from the index并且在使用git status.
我对究竟发生了什么一无所知。它是被删除或隐藏在索引中的某个地方,还是其他什么地方?
我'使用windows,git bash提示符
我正在尝试使用bitbucket的git archive命令
我收到错误遥控器:"git upload-archive:archiver死于错误"
有任何想法吗 ?
git archive --remote = ssh://git@bitbucket.org/username/reponame.git --format = tar --output ="file.tar"
我已经创建了所有SSH密钥和公钥等,甚至测试了ssh -v hg@bitbucket.org,它运行正常
我在 Windows 上使用最新的 git bash (git 版本 2.6.3.windows.1),并且我正在尝试覆盖我的本地存储库。首先我做了:
git fetch /c/users/xxx/dropbox/repo/master
Run Code Online (Sandbox Code Playgroud)
那我就做
git reset --hard /c/users/xxx/dropbox/repo/master
Run Code Online (Sandbox Code Playgroud)
但 git 返回:
fatal: Invalid object name 'C'.
Run Code Online (Sandbox Code Playgroud)
错误信息的含义是什么?