git pull后如何切换回上一个分支? [英] How to switch back to previous branch after git pull?

查看:253
本文介绍了git pull后如何切换回上一个分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑像这样刷新git分支:

I'm thinking of refreshing a git branch like this:

git checkout master && git pull && git co - && git rebase master

如果从原点提取了任何更改,则先前的分支将被覆盖,并且'git co -'不再返回到先前的分支.

If any changes are pulled from origin then the previous branch gets overwritten and 'git co -' no longer returns to the previous branch.

(当然,我可以使用分支的名称,但是我正在寻找可以在别名中转换的一般适用的东西.)

(Of course I could use the name of the branch, but I'm looking for something generally applicable that can be transformed in an alias.)

推荐答案

为什么不只留在分支上做

Why not just stay on the branch and do

 git fetch origin master && git rebase origin/master

不担心所有分支切换吗?

and not worry about all the branch switching?

这篇关于git pull后如何切换回上一个分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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