首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >查看上次显示的git fetch

查看上次显示的git fetch
EN

Stack Overflow用户
提问于 2011-07-15 18:37:14
回答 2查看 280关注 0票数 4

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

如何再次显示它们?

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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-07-15 21:19:07

编辑

从评论中:

要获取所有远程分支上刚才所做的更改,请执行以下操作

代码语言:javascript
复制
git for-each-ref refs/remotes | 
    while read ref type name
    do 
        echo ----- $name
        git log --oneline "$name@{1}..$name@{0}"
    done

典型输出:

代码语言:javascript
复制
----- 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}之间没有可访问的提交,具有警告的分支在日志中没有先前的ref值。

奖金

我更喜欢调整日志:

...$name@日志--oneline -graph --left-right --cherry-pick \“git {1}graph{0}”

(请注意... (!)中的额外圆点)

这将显示合并方向,并显示非线性提交差异;例如,它可以很好地显示可能已被强制推送(或拉出)的ref中的差异。

要获取所有分支的reflog信息,只需

代码语言:javascript
复制
git log -g --oneline --branches

您将得到类似于以下内容的输出:

代码语言:javascript
复制
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
票数 2
EN

Stack Overflow用户

发布于 2011-07-15 20:11:06

git reflog show origin/master似乎可以工作;我想应该对每个分支都运行它。我不认为有一个单独的reflog命令来提取所有分支的数据

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6705759

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档