0

I have a single repo where each branch specifies different approaches to the same problem:

$ git branch
approach1
approach2
approach3

Now for each of these approaches, I have several auxiliary files, but the auxiliary files are specific to each branch.

So my question is: Is it possible to have these files not be tracked, but move with the branch when I git checkout and move to a different branch?

This is what I would like to happen when I move to different branches:

$ git checkout approach1
$ ls
notrack_test1.cpio.gz  notrack_test2.tar  notrack_test2-logging.img
tracked1/  tracked2.tmp

$ git checkout approach2
$ ls
notrack_check1.cpio.gz  notrack_check2.cpio.zip
notrack_check2-no_cam.img  tracked1.img  tracked_source/

Is this possible? The main reason I need to do this is because I have a large amount of auxiliary files per branch that should not be committed and not tracked.

  • would it be possible to just have a pool of these files where all files from all approaches go? and then just skip the shifting-around part? – mnagel Jul 05 '13 at 08:53
  • Yes, but my goal in doing this is to keep everything organized per branch and right there with the rest of my files when I switch branches. Otherwise I would keep everything in a separate directory structure. files/approach1, files/approach2, etc. – user1010101010101 Jul 05 '13 at 13:44

1 Answers1

1

As the files are not tracked, git has nothing to do with them.

You could implement a shell script to move the files as you wish. Then you need to put under revision control only this script, and execute it when you switch between branches. You can probably even make it run automatically every time you checkout using post-checkout git hook (see also man page).

esycat
  • 1,324
  • 11
  • 10