[petsc-dev] getting rid of annoying old branches

Satish Balay balay at mcs.anl.gov
Fri Apr 11 20:44:39 CDT 2014


I belive the procedure is:

1. delete the branch in the remote repo.

https://bitbucket.org/petsc/petsc/wiki/quick-dev-git

Delete remote branch: git push origin :<branchname> (mind the colon in front of the branch name)

2. And then everyone would have to update their clones with this info

git remote prune origin

3. However if some of these remote branches are checked out locally -
one would have to manually delete them

Delete local branch: git branch -d <branchname> (only after merge to master is complete)

[but to get the list of local branches to delete - we would have to do
'git branch' and 'git branch -r' and compare.]

Satish


On Fri, 11 Apr 2014, Barry Smith wrote:

> 
>   How do I get rid of these meaningless old branches?
> 
> ~/Src/petsc  next $ git branch -D barry/mat-nonzero-structure-state
> Deleted branch barry/mat-nonzero-structure-state (was 5b70ec7).
> ~/Src/petsc  next $ git branch -D barry/mat-nonzero-structure-state-2
> Deleted branch barry/mat-nonzero-structure-state-2 (was 953deea).
> ~/Src/petsc  next $ git branch -D barry/rm-indirection-of-jacobian-in-snessetjacobian
> Deleted branch barry/rm-indirection-of-jacobian-in-snessetjacobian (was 7d7ace8).
> ~/Src/petsc  next $ gitnotmerged 
>   origin/barry/add-snespseudo
>   origin/barry/august-tutorial
>   origin/barry/html
>   origin/barry/make-petscoptionsobject-nonglobal
>   origin/barry/mat-nonzero-structure-state
>   origin/barry/mat-nonzero-structure-state-2
>   origin/barry/new-test-makefiles
>   origin/barry/newhtml
>   origin/barry/rm-indirection-of-jacobian-in-snessetjacobian
>   origin/barry/saws-options
>   origin/barry/superlu_mt
>   origin/barry/twitter
>   origin/test-barry-mat-nonzero-structure-state-2
> ~/Src/petsc  next $ alias 
> alias gitmasternotupdated='comm -12 <(git branch -r --merged next | grep origin/ | sort) <(git branch -r --no-merged master ) | xargs -n1 git log -1 --format='\''%Cgreen%ci %C(yellow)%d%Creset %s'\'' --abbrev-commit | grep barry | sed '\''s?origin/[a-z/-]*, ??g'\'' | grep -v '\''(next)'\'' | cut -b 1-156'
> alias gitmasternotupdatedall='comm -12 <(git branch -r --merged next | grep origin/ | sort) <(git branch -r --no-merged master ) | xargs -n1 git log -1 --format='\''%Cgreen%ci %C(yellow)%d%Creset %s'\'' --abbrev-commit |  sed '\''s?origin/[a-z/-]*, ??g'\'' | grep -v '\''(next)'\'' | cut -b 1-156'
> alias gitnotmerged='git branch -r --no-merged next | grep barry’
> 
> 
> 


More information about the petsc-dev mailing list