gpt4 book ai didi

git - 看看 git fetch 上次显示了什么

转载 作者:太空狗 更新时间:2023-10-29 13:41:44 28 4
gpt4 key购买 nike

在我获取远程数据 (git-fetch) 之后,git 足够友好地告诉我每个分支上的 SHA,old..new,但是如果我在控制台工作了很多,我可能会失去它们。

如何再次显示它们?

当然我可以将输出保存到文件或记住它。这些对我来说没有选择。

最佳答案

编辑

来自评论:

要获取所有远程分支上刚刚的更改,请执行

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} 之间没有可访问的提交,带有警告的分支没有先前的引用值 在日志中。

Bonus

I prefer to tweak the log as well:

     git log --oneline --graph --left-right --cherry-pick \
"$name@{1}...$name@{0}"

(note the extra dot in ... (!))

This will show the merge directions, and also show non-linear commit differences; I.e. it works well in showing differences in refs that may have been force-pushed (or pulled)


要获取所有分支的 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

关于git - 看看 git fetch 上次显示了什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6705759/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com