by lelanthran · 3y ago · 0 comments
Anyway, when working on feature branches I wanted a quick way to switch to master, pull, switch back and finally rebase.
So I made a little script (https://gist.github.com/lelanthran/6c9bd1125f89e7621364878d1...) that pushes the current branch name onto a stack before switching to a new branch, and allows me to switch back to the topmost branch on the stack.
xgit master # Switch to master from current <really long branchname>
git pull
xgit pop # Switches back to <really long branchname>
git rebase master
I use this now very frequently; when I need to switch to branches I use `xgit <branch>`, because then I can switch back easily using `xgit pop`. g co master
g fetch
g rebase
g co -
g rebase -
Where ’alias g=git’ and ’g config alias.co=checkout’Or to move back N branches you can do: `git checkout @{-N}`