问题
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