Skip to contentSkip to conversation

how to hide some branches

DISCUSSION Pascal Obry 4 participants 5 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

Hello everyone,

I create a new branch for every new feature/fix I work on. After some time I have many (too much) branch listed when doing:

   $ git branch

I'd like to hide some (not removing them).

Is there a solution for this?

How you people handle this?

Thanks.

Pascal.

Signature · 8 lines
--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
#1 lore raw
Quoted 5 lines · Pascal Obry

Hello everyone,

I create a new branch for every new feature/fix I work on. After some time I have many (too much) branch listed when doing:

Quoted 7 lines
   $ git branch

I'd like to hide some (not removing them).

Is there a solution for this?

From a suggestion by Jakub Narebski, I use an alias "lb" that shows

the most recently-active 8 branches:

  for-each-ref --format='%(refname:short)' \
       --sort=-authordate --count=8 refs/heads/

--Pete

#2 lore raw
Quoted 5 lines · Pete Harlan
Quoted 1 line

From a suggestion by Jakub Narebski, I use an alias "lb" that shows

the most recently-active 8 branches:

  for-each-ref --format='%(refname:short)' \
       --sort=-authordate --count=8 refs/heads/

Thanks, I like this one. Probably the best approach to me.

Signature · 8 lines
--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.net
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595
#3 lore raw
In reply to Pascal Obry

2008/11/30 Pascal Obry <[email protected]>:

Quoted 10 lines

I create a new branch for every new feature/fix I work on. After some time I have many (too much) branch listed when doing:

  $ git branch

I'd like to hide some (not removing them).

Is there a solution for this?

How you people handle this?

Rename them into something _not_ under refs/heads:

git update-ref refs/hidden/branch branch
git branch -D branch

?

#4 lore raw
In reply to Pascal Obry

Pascal Obry:

Quoted 2 lines

I'd like to hide some (not removing them).
Is there a solution for this?

git branch --no-merged

shows only the branches that has not been merged into your current working branch. That might be one solution.

I don't know if it is possible to set it as a default option, but I would also appreciate such a feature.

I use the "git branch --merged" to move away merged branches into a different "namespace" (branch "a" becomes "merged/a"):

  for branch in $(git branch --merged master | egrep -v 'merged|master');
  do
    git branch -m "$branch" "merged/$branch"
  done
Signature · 1 line
\\// Peter - http://www.softwolves.pp.se/