(no title)
WickyNilliams | 9 days ago
# remove merged branches (local and remote)
cleanup = "!git branch -vv | grep ': gone]' | awk '{print $1}' | fzf --multi --sync --bind start:select-all | xargs git branch -D; git remote prune origin;"
https://github.com/WickyNilliams/dotfiles/blob/c4154dd9b6980...I've got a few aliases that integrate with fzf like an interactive cherry pick (choose branch, choose 1 or more commits), or a branch selector with a preview panel showing commits to the side. Super useful
The article also mentions that master has changed to main mostly, but some places use develop and other names as their primary branch. For that reason I always use a git config variable to reference such branches. In my global git config it's main. Then I override where necessary in any repo's local config eg here's an update command that updates primary and rebases the current branch on top:
# switch to primary branch, pull, switch back, rebase
update = !"git switch ${1:-$(git config user.primaryBranch)}; git pull; git switch -; git rebase -;"
https://github.com/WickyNilliams/dotfiles/blob/c4154dd9b6980...
lloeki|9 days ago
I mean, while useless in terms of `git init` because the repo's already init'd, this works:
And if you have `init.defaultBranch` set up already globally for `git init` then it all just worksWickyNilliams|9 days ago
In any case the main thrust was just to avoid embeddings assumptions about branch names in your scripts :)
MathiasPius|9 days ago
hiccuphippo|9 days ago
WickyNilliams|9 days ago
mroche|9 days ago
huntervang|9 days ago