开发者

Git dealing with large amounts of files which shouldn't be checked into svn

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开发者_JAVA百科 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?


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜