At work each project has a few branches related to our gitops setup that mostly are in the way in the daily work. I add negative refspecs to `.git/config` to tell git to ignore them. However, this doesn't remove them from the output of my favourite log command[1]. In order for that to happen I currently manually edit `.git/packed-refs`, removing the mentions of all uninteresting refs.

It does feel like there ought to be a better, less manual and less error prone, way to get git to clean them out.

Here's a stanza with the added negaitve refspecs for a project I cloned today:

   [remote "origin"]
           url = g...@github.com:my-org/my-proj.git
           fetch = +refs/heads/*:refs/remotes/origin/*
           fetch = ^refs/heads/staging
           fetch = ^refs/heads/sandbox
           fetch = ^refs/heads/production
           fetch = ^refs/heads/travis-test-output
           fetch = +refs/notes/*:refs/notes/*
           push = +refs/notes/*:refs/notes/*

Which I later had to go in and manually modify the `.git/packed-refs` for in order for them to stop showing up.

If there's an even better way to hide away uninsteresting branches I'd love to hear about it too.

/M

[1]: `git log --graph --decorate --pretty=lola --abbrev-commit --branches --remotes`

--
Magnus Therning                   OpenPGP: 0x927912051716CE39
email: mag...@therning.org
@magthe@mastodon.technology       http://magnus.therning.org/

Action is the foundational key to all success.
    — Pablo Picasso

--
You received this message because you are subscribed to the Google Groups "Git for 
human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/git-users/87o85gal1t.fsf%40therning.org.

Reply via email to