4

I'm using git behind svn, and for each branch I have, I need to do a full build (which takes a few minutes). These build files should NOT be checked in, but they are intermingled with user-modified files, which means I cannot just exclude the directory. The user-modified files are likely to change, also, which means I can't make special rules for just those files.

Is there a way to maintain a set of non-checked-in files in git in each branch? What are my options?

Stefan Kendall
  • 66,414
  • 68
  • 253
  • 406

3 Answers3

0

If there is a clear naming convention (which can vary per branch), you could have a different .gitignore per branch, with the right rules in order to exclude those build files within a directory.

You can combine that with a merge driver to preserve those .gitignore content during merges between branches.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
0

If you setup gitignore to ignore all files, then git will never prompt you to add new files to your repo. However, any files checked-in will be treated as normal tracked files.

PROJECT_ROOT/.gitignore:

*

You can then add new files with git add -f FILENAME

cmcginty
  • 113,384
  • 42
  • 163
  • 163
0

This doesn't directly answer your question, but if repairing your build process is an option, a standard approach is to put build-generated files in a completely separate directory ... it avoids headaches like this and makes 'clean' actions simpler as well.

Zac Thompson
  • 12,401
  • 45
  • 57