Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我刚才在哪个git分公司?_Git - Fatal编程技术网

我刚才在哪个git分公司?

我刚才在哪个git分公司?,git,Git,我的工作流程通常包括以下内容: 致力于长期功能分支(称之为“a”) 签出master并创建修补程序分支(称之为“B”) 推动我的修补程序 然后我就忘了在那之前我在干什么了 是否有任何类型的git历史记录可以向我显示我之前正在处理的是分支A?试试: git reflog git branch --sort=-committerdate 这将列出你最近所有改变某些东西的行为,例如签出、重设基础、拉、推等等 还包括所有的提交ID,例如,如果你做了十几个提交-修改< /C> >你可以跳回中间的一

我的工作流程通常包括以下内容:

  • 致力于长期功能分支(称之为“a”)
  • 签出master并创建修补程序分支(称之为“B”)
  • 推动我的修补程序
  • 然后我就忘了在那之前我在干什么了
是否有任何类型的git历史记录可以向我显示我之前正在处理的是分支A?

试试:

git reflog
git branch --sort=-committerdate
这将列出你最近所有改变某些东西的行为,例如签出、重设基础、拉、推等等

还包括所有的提交ID,例如,如果你做了十几个<代码>提交-修改< /C> >你可以跳回中间的一个。

git reflog
git branch --sort=-committerdate

如中所述,语法
@{-number}
指的是以前签出的分支数。这使用了reflog,特别是
头部的reflog;看

(在您的特定示例中,您需要
@{-1}
。对于
git checkout
,您可以将其缩写为
git checkout-
,但这仅适用于
git checkout

转到以前使用的分支

我还设置了这个别名,用于打印我处理过的最后10个分支:

[alias]
    recent = for-each-ref --count=10 --sort=-committerdate refs/heads/ --format='%(refname:short) %(committerdate:relative)'

@邓肯:是的;除了“我刚才在哪里”之外,我还会仔细阅读reflog: