Michal Kordas
Michal Kordas

Reputation: 10925

Rebase branch against origin/master in IntelliJ IDEA

When developing feature on branch I'd like to rebase it frequently with origin/master.

The option Update Project... (CTRL+T) would be great, as it can be configured to do stash, rebase and unstash. However, by default it rebases against tracking branch, which is not origin/master and I don't want to change it (I want to track the branch for which pull request is raised).

Is there any way in IntelliJ to do a stash, rebase origin/master and unstash with one keyboard shortcut?

Upvotes: 3

Views: 4637

Answers (2)

Michal Kordas
Michal Kordas

Reputation: 10925

Thanks to Vampire's comment I've found efficient way to do it in IDEA using External Command. Just configure it like below and attach shortcut to it:

enter image description here

Magic is done by super-powerful and fast git pull --rebase --autostash origin master. Note: it works only with Git 2.7+.

Upvotes: 3

Vampire
Vampire

Reputation: 38639

To assign a shortcut to Git -> Rebase..., just open the Keymap setting and assign it any key combination you want to have. There you can select what to rebase from where to where.

Or by using the mouse you can click in the status bar on the lower left on Git: <feature> and then select origin/master to rebase onto it.

If you need stash -> rebase origin/master -> unstash on one keypress, I guess you have to write some script that does it, then add this as external tool to IDEA and then assign that external tool any shortcut you like.

Upvotes: 3

Related Questions