aherriot
aherriot

Reputation: 4725

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

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?

Upvotes: 1

Views: 285

Answers (3)

urbanaut
urbanaut

Reputation: 761

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

Upvotes: 0

Alexan
Alexan

Reputation: 8637

One line version:

git pull --rebase --autostash origin master

Upvotes: 3

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.

Upvotes: 0

Related Questions