在我获取了远程数据(git-fetch
)后,git非常友好,可以告诉我每个分支上的SHA old..new
,但是如果我在控制台中工作很多,我可能会丢失它们。
如何再次显示它们?
当然我可以将输出保存到文件中或记住它。这些对我来说都没有选择。
答案 0 :(得分:2)
修改强>
来自评论:
要在所有远程分支上更改 ,请执行
git for-each-ref refs/remotes |
while read ref type name
do
echo ----- $name
git log --oneline "$name@{1}..$name@{0}"
done
典型输出:
----- refs/remotes/sehe.nl/stable
warning: Log for 'refs/remotes/sehe.nl/stable' only has 1 entries.
----- refs/remotes/sehe.nl/testing
4934e92 reviewed INSTALL file as per #1331
----- refs/remotes/sehe.nl/unstable
----- refs/remotes/sehe.nl/xattrs
warning: Log for 'refs/remotes/sehe.nl/xattrs' only has 1 entries.
----- refs/remotes/tobey/maint
6215be7 reviewed INSTALL file as per #1331
----- refs/remotes/tobey/maint-0.6.9
warning: Log for 'refs/remotes/tobey/maint-0.6.9' only has 1 entries.
----- refs/remotes/tobey/master
warning: Log for 'refs/remotes/tobey/master' only has 1 entries.
----- refs/remotes/tobey/testing
4934e92 reviewed INSTALL file as per #1331
请注意,unstable
@ {1} .. @ {0}之间只有无可达提交,警告的分支没有先前的参考值在日志中。
加成
我也喜欢调整日志:
git log --oneline --graph --left-right --cherry-pick \ "$name@{1}...$name@{0}"
(注意......(!)中的额外点)
这将显示合并方向,并显示非线性提交差异;即它可以很好地显示可能已被强制推送(或拉动)的参考文献中的差异
要获取所有分支的reflog信息,只需
git log -g --oneline --branches
您的输出类似于:
4934e92 testing@{0}: commit: reviewed INSTALL file as per #1331
6215be7 maint@{0}: commit: reviewed INSTALL file as per #1331
1e5e121 emmanuel@{0}: rebase finished: refs/heads/emmanuel onto f6e2c6c3f9cec0ccf7d96d3edb92f806587adcbc
7b326b9 emmanuel@{1}: branch: Created from rainemu/master e96783e compress@{0}: rainemu/compress: updating HEAD
ff19004 compress@{1}: rebase finished: refs/heads/compress onto f6e2c6c3f9cec0ccf7d96d3edb92f806587adcbc
f6e2c6c unstable@{0}: rebase -i (abort): updating HEAD
6b8f506 unstable@{1}: commit (merge): Merge remote branch 'rainemu/master' into unstable 5327c2f unstable@{2}: merge rainemu/master: Merge made by recursive.
f6e2c6c unstable@{3}: merge emmanuel: Fast-forward
f45ff54 unstable@{4}: merge rainemu/master: Merge made by recursive.
e23fc0b maint@{1}: commit: fix scons warnings dd52720 master-lucid@{0}: commit: lucid 1fb30cf testing@{1}: commit: fix missing split on environment CFLAG
aac7936 unstable@{5}: pull rainemu master: Merge made by recursive.
2c01d7f unstable@{6}: branch: Created from sehe.nl/unstable 927ad7a testing@{2}: branch: Created from sehe.nl/testing
3b32fa7 maint@{2}: branch: Created from sehe.nl/maint 6eaa64f maint-0.6.9@{0}: branch: Created from sehe.nl/maint-0.6.9
答案 1 :(得分:1)
git reflog show origin/master
似乎有效;我想,为每个分支运行它。我认为没有一个reflog命令可以为所有分支提取数据