I’d like to be able to make local (never tracked, never committed) files “stick” to certain git branches.
For example, I’d like to be able to do something like:
$ git checkout version1.0
$ make
$ ./myProject # 1.0 binary
$ git stick-to-current-branch myProject
$
$ git checkout version2.0
$ make
$ ./myProject # 2.0 binary
$ git stick-to-current-branch myProject
$
$ git checkout version1.0
$ ./myProject # 1.0 binary from above
I made up the “stick-to-current-branch” command, but is there something that does this for real? I never want to commit these files; they’re branch-specific but shouldn’t be tracked.
No, there is no option to “stick” a file that is not tracked by git in the checked out working directory of different branches. You can however “generate” the file during checkout ( like using a
post-checkouthook – run yourmakein the post-checkout hook so that themyProjectbinary is generated for the branch / version)