views:

50

answers:

3

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?

A: 

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.

VonC
A: 

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

Casey
Thoughts on how to setup intellij to always use add -f? :P
Stefan Kendall
A: 

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