git检出另一个分支的代码
Command line shortcuts are can be a huge time saver, which is why I like creating bash aliases and and enjoy other tricks I've found. I do have a list of tasks I don't yet have a shortcut for, like easy switching between my current branch and the previous branch. I have to do this often when I update master via remote pull and then rebasing a feature branch, and since many of my branch names include a hard to remember bug number, switching between branches is a pain.
命令行快捷键可以节省大量时间,这就是为什么我喜欢创建bash别名并享受发现的其他技巧的原因。 我确实有一个我没有快捷方式可完成的任务列表,例如在当前分支和上一个分支之间轻松切换。 当我通过远程请求更新master然后重新建立功能分支时,我经常必须这样做,并且由于我的许多分支名称都包含一个难以记住的错误号,因此在分支之间进行切换是很痛苦的。
I recently found out that you can switch the the previous branch you were on using the following command:
我最近发现,您可以使用以下命令切换以前的分支:
git checkout master
# Do whatever
git pull remote master
# Go back to the previous branch
git checkout -
Using -
references the previous branch name, thus allowing you to navigate branches with ease!
使用-
引用先前的分支名称,从而使您可以轻松导航分支!
git检出另一个分支的代码