Last Updated: October 11, 2021
·
2.597K
· twolfson

Checkout/Merge previous branch

Similarly to cd -, git checkout - and git merge - will checkout/merge the previous branch respectively.

For example, if you are in dev/new.modal and you run git checkout master. Then, git merge - will merge dev/new.modal to master.

Related protips:

fatal: refusing to merge unrelated histories

2 Responses
Add your response

Thanks! I had no idea that would work. This will make merging and moving around branches much easier.

over 1 year ago ·

Didn't know merge could be used with - as well. Super pro tip thanks Bro!

over 1 year ago ·