0

我一直在通过玩它的命令和阅读东西来学习 git。这是我可以看到的,我期待一个类似于我在右边所做的图表。

这很令人困惑,因为我看不到其他提交,所以树应该是什么样子?为什么我看不到我的提交?

在此处输入图像描述

这是我所做的:

  • c08b318提交了一个名为 README.md 的文件并推送到 master
  • 创建了一个名为somethingnew
  • 643f1b0在分支上修改 README.mdsomethingnew然后提交修改后的文件
  • checkout master 分支做了 2 次提交1029180ad34cc2
  • 然后移动结帐somethingnew创建了一个名为 NewFile.txt 的新文件并提交了该文件a526cd9
4

2 回答 2

2

Try gitk --all,它将显示存储库中的所有分支和标签。

默认情况下,你得到的只是当前分支的祖先。

于 2012-11-26T14:43:10.067 回答
0

Git 提交日志是分支本地的,因此在此处发生合并之前 - 您不会在可视日志中看到该提交,除非您已签出该分支。

spiders-iMac:git-practice david$ git checkout master
spiders-iMac:git-practice david$ git log --oneline
f1aa76b Contents added to FileA
3c5a4fc Initial commit on master


spiders-iMac:git-practice david$ git checkout somethingnew
Switched to branch 'somethingnew'


spiders-iMac:git-practice david$ git log --oneline
187cd79 Merge branch 'master' into somethingnew
f1aa76b Contents added to FileA
a8fe187 Added FileB on branch somethingnew
3c5a4fc Initial commit on master


spiders-iMac:git-practice david$ git reflog
187cd79 HEAD@{0}: checkout: moving from master to somethingnew
f1aa76b HEAD@{1}: checkout: moving from somethingnew to master
187cd79 HEAD@{2}: checkout: moving from master to somethingnew
f1aa76b HEAD@{3}: checkout: moving from somethingnew to master
187cd79 HEAD@{4}: merge master: Merge made by the 'recursive' strategy.
a8fe187 HEAD@{5}: checkout: moving from master to somethingnew
f1aa76b HEAD@{6}: commit: Contents added to FileA
3c5a4fc HEAD@{7}: checkout: moving from somethingnew to master
a8fe187 HEAD@{8}: commit: Added FileB on branch somethingnew
3c5a4fc HEAD@{9}: checkout: moving from master to somethingnew
3c5a4fc HEAD@{10}: commit (initial): Initial commit on master
spiders-iMac:git-practice david$ 
于 2012-11-26T14:38:40.400 回答