有没有简单的方法可以更改为以前处于活动状态的分支? [英] Is there an easy way to change to previously active branch?

查看:69
本文介绍了有没有简单的方法可以更改为以前处于活动状态的分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用git(实际上是msysgit)1.6.4。大多数时候,我在某些功能部门工作。我时不时地想跳回去掌握我在功能分支中所做的特定提交-通常是因为它是一个有用的错误修正,即使没有该功能也很有意义。我的工作流程是这样的-如果这不必要地复杂,请告诉我:-):

I'm using git (in fact, msysgit) 1.6.4 on Windows. Most of the time I'm doing work in some feature branches. Every now and then, I want to hop back to master to cherry-pick one particular commit I did in my feature branch - usually because it's a useful bugfix which makes sense even without the feature. My workflow is like this - if this is unnecessarily complicated, please tell me :-) :


git checkout -b mycoolfeaturebranch
// hack away, implementing a feature and one bugfix (while I'm at it)

git add file_with_bugfix.cpp
git commit -m "Fixed bug 12345  // commit the bugfix
git checkout master             // hop over to master
git cherry-pick                 // bring the bugfix into master

At至此,我通常想跳回我的功能分支以继续进行功能工作。不幸的是,我的分支名称趋于变长(例如 mycoolfeaturebranch),并且我没有git分支名称标签完成Windows。

At this point, I usually want to hop back to my feature branch to continue work on the feature. Unfortunately, my branch names tend to become a little long (like, 'mycoolfeaturebranch') and I don't have git branch name tab completion on Windows.

在Unix shell上是否有类似 cd-的东西(跳到上一个目录,对于在两个目录之间切换)? git checkout-会很棒。:-)

Is there maybe something like cd - on Unix shells (which hops to the previous directory, useful for toggling between two directories)? A git checkout - would be great. :-)

推荐答案

从$ GIT / Documen起tation / RelNotes-1.6.2.txt:

From $GIT/Documentation/RelNotes-1.6.2.txt:


  • git checkout-是 git checkout @ {-1}的简写。

您尝试过吗?

这篇关于有没有简单的方法可以更改为以前处于活动状态的分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆