简体   繁体   English

试图解释'git log --graph'的输出

[英]Attempting to interpret output of 'git log --graph'

I've done a 'git --reset hard origin/master' on a local branch so I'm expecting my local branch to match exactly to the remote one. 我已经在本地分支上执行了'git --reset hard origin/master' ,所以我希望本地分支与远程分支完全匹配。 However when I do a: 但是,当我做一个:

git log --graph --oneline --decorate --all

I get the following output at the top: 我在顶部得到以下输出:

*   dfd9bc6 (refs/stash) On z_tmp2: tmp1
|\  
| * 49f3b6f index on z_tmp2: 84e2002 localconfig
|/  
* 84e2002 localconfig
| * 1110f48 (origin/congo-3.1-stable) Boiler plate code to support

Commits 84e2002, 49f3b6f and dfd9bc6 appear to be local work which I though would've been wiped out by the 'reset --hard' , but apparently I'm missing something. 提交84e2002,49f3b6f和dfd9bc6似乎是本地工作,尽管我会被'reset --hard'淘汰,但显然我缺少了一些东西。

The reset does not wipe anything out, it only literally resets a branch to a different commit. reset不会清除任何内容,它只是将分支重置为其他提交。

As you can see in your log output, you still have a ref ( refs/stash , your default stash ) pointing to your old commits. 正如您在日志输出中看到的那样,您仍然有一个ref( refs/stash ,您的默认stash )指向您的旧提交。

If you do not need those commits any longer and want to make them disappear from the log, use 如果您不再需要那些提交并想使它们从日志中消失,请使用

git stash drop

The actual deletion of the commits from the Git object store will happen with the next run of Git's garbage collector, once the commits are no longer referenced. 一旦不再引用提交,就会在下一次运行Git的垃圾收集器时从Git对象存储中实际删除提交。 But unless you have disk space issues, you probably won't have to worry about that. 但是除非存在磁盘空间问题,否则您不必担心。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM