Here’s a handy set of aliases for .gitconfig
that can make working with many repos with different trunk names easier.
[alias]
tru = "!git checkout `git ftr`"
ftr = "!git symbolic-ref refs/remotes/origin/HEAD|sed 's@^refs/remotes/origin/@@'"
When git tru
is used, ftr
gets the name of the ref for HEAD
and strips everything but that name off, before passing it to git checkout
.