我们正在使用我克隆的中央 git 存储库,并且正在本地分支上工作。
当我想让我的更改在中央存储库中可用时,我必须发出以下命令(从 开始mybranch
):
#Stash local changes not yet ready for checkin
git stash
#Make sure we have all changes from the central repository
git checkout master
git pull
#Rebase local changes
git checkout mybranch
git rebase
#Push changes
git checkout master
git merge mybranch
git push
#Back to my branch and continue work
git checkout mybranch
git stash apply
我想知道是否可以使用更少的 git 命令来实现相同的目标。master
和之间的几个切换mybranch
特别烦人,因为我们的存储库相当大,所以它们需要一些时间。