- -

Configure SourceTree to stash before pull & unstash after merge

SourceTree is my favourite tool for a while i used it when working with Git repositories.

As i'm GitFlow addict and often create feature and release branches during my work, and SourceTree helps a lot with this.

But it's a headache to see this message, when i wanna pull a branch while having local changes:

to solve this i must go into shell and type:

git stash
git pull --rebase
git stash pop

Also we can pack this into Custom Action and use from context menu:

Another way is to use a feature that is supported natively by Git since v2.7.0.

All you need to do is set the following global config flag:

git config --global rebase.autostash true

And now we no longer dependent on SourceTree to have this feature.


Photo by Yancy Min