0

I have a series of branches with a prefix, I wish to reuse this prefix but not group them with the existing branches with this prefix (which are now obsolete). I Have for the time made a subdirectory in .git/refs/heads.

I want to know if there are any adverse side effects, or better recommendations for where to put a set of branch names to give them a prefix. They do not need to be cloned/pushed/pulled to any other repositories at this time, though such ability may be nice.

P.S. It would be nice if these branches remained easy to checkout as well.

ThorSummoner
  • 16,657
  • 15
  • 135
  • 147
  • This isn't entirely clear. Why do you you need to directly mess around inside the .git directory at all? If the old branches are obsolete, why can't you just delete them? Even if you can't delete the old ones, what is the detrimental effect of sharing a prefix? – Oliver Charlesworth Sep 11 '14 at 20:47

1 Answers1

1

I cannot see why you should not be able to just rename your branches with git branch -m $OLD_NAME $NEW_NAME. E.g say the prefix is test/ and you want to obsolete the msdos and minix test branches while keeping all the other test branches as is, but you still want to be able to access the obsoleted branches:

$ git branch --all
* master
  test/linux
  test/minix
  test/msdos
  test/openbsd
  test/windows
$ git branch -m test/minix obsolete/test/minix
$ git branch -m test/msdos obsolete/test/msdos
$ git branch --all
* master
  obsolete/test/minix
  obsolete/test/msdos
  test/linux
  test/openbsd
  test/windows
$

Update:

Yes, those branches are sub directories under .git/refs/head

$ find .git/refs/heads/ -type f
.git/refs/heads/obsolete/test/msdos
.git/refs/heads/obsolete/test/minix
.git/refs/heads/test/openbsd
.git/refs/heads/test/linux
.git/refs/heads/test/windows
.git/refs/heads/master
$
hlovdal
  • 26,565
  • 10
  • 94
  • 165
  • I think this answer alludes to refs/heads subfolder 9atleast one level deep) being totally safe. Would you be so kind to tell me if there is a subfolder in your `.git/refs/heads` folder named `test`. I think this usage is 100% A-OK – ThorSummoner Sep 11 '14 at 21:38