How do I git rebase from master in fewer commands when I have local file changes

我怕爱的太早我们不能终老 提交于 2021-01-29 02:30:21

问题


If I am working on a feature branch, and I want to fetch and rebase in changes from the master branch, is there a shorter way to do it than this?

git stash
git checkout master
git pull
git checkout my-feature-branch
git rebase master
git stash pop

Note how I have to stash too, because I have edited a config file that I don't want to commit.

How can I do this in fewer commands?


回答1:


One line version:

git pull --rebase --autostash origin master



回答2:


Perhaps you can write a script for this.

I think against git rebase master is better git merge master --no-ff

If you use gitflow, there are some maven plugin to make a feature branch or finish feature branch etc. But the feature branch is from develop branch not from master.




回答3:


If you have zsh you can use oh-my-zsh, which provides an alias for git rebase master that's just grbm



来源:https://stackoverflow.com/questions/53436770/how-do-i-git-rebase-from-master-in-fewer-commands-when-i-have-local-file-changes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!