kieranpotts / dotfiles

A baseline, extensible UNIX user configuration.
MIT License
1 stars 0 forks source link

Git "done" or "archive" alias to preserve merged feature branches #223

Open kieranpotts opened 1 year ago

kieranpotts commented 1 year ago

In some workflows I want to keep feature branches for a while longer, for reference. To help me sort through my active branches, I would rename this stale branches, adding the done/ prefix. Here is the alias that came out of that workflow:

done = "!f() { git branch | grep "$1" | cut -c 3- | grep -v done | xargs -I{} git branch -m {} done-{}; }; f"

Source: https://www.durdn.com/blog/2012/11/22/must-have-git-aliases-advanced-examples/