Ask HN: How do you organize your git branches?

7 points by awt ↗ HN
I frequently have several branches that I've yet to merge into master. I've been been keeping track of them in the form of a list of branch names in a text file. As I merge them in to master, I remove them from the list. Is there a better way?

5 comments

[ 3.2 ms ] story [ 28.3 ms ] thread
I use branches called feature/foo, feature/bar, etc, and bug fixing branches named after the bug, eg. bug/42. Before a complicated rebase I often back up by branching to a branch named backup/foo, and I also have bits of experimental code in branches like experimental/foo or deadend/foo.

I rebase feature branches against master before merging them, so they are always a fast-forward merge. Then there's no reason at all to keep them around after the merge, so they go away. Same with the bug branches.

Do you know about "git branch"? It gives you a list of branches. What are you storing in your text file in addition to this list?

I use git branch all the time. I'm just keeping a list of branches that need to go out in the next release in the text file (maybe with some notes).
Use a bug tracker for that!
Using Stacked Git to maintain multiple patches is a useful alternative to keeping multiple branches for some workflows. Obviously it depends on what you're doing with them.
Cool thanks for the tip.