I have read this manual: http://git-scm.com/docs/gitignore
As I am working with gitosis, I rather use a .gitignore than explicit git commands. Thus says the manual:
Of course, not tracking files with git is just a matter of not calling git add on them. But it quickly becomes annoying to have these untracked files lying around; e.g. they make git add . practically useless, and they keep showin开发者_如何学Cg up in the output of git status.
You can tell git to ignore certain files by creating a file called .gitignore in the top level of your working directory
I basically want to ignore everything, except two directories, recursively. Let's say /mywebapp (that contains two subdirectories like stylesheets and javascripts) and /mydata are those two directories. Now, I've been already told git does not track directories, but just files. The !-mark excludes, so I assume this could work with directories too. I figured out that using * would ignore everything else. How would I write up my .gitignore file?
My question is not how to add these directories manually by explicit adding. My question is how this is done inside a gitignore file.
Thanks for your help, comments and feedback.
First, the '*
' is delegated to the fnmatch
function which doesn't always works the same on all platform.
With my msysgit, I manage to ignore all subdirectories content except one with
*/
!mySubDir
So in your case:
*/
!mywebapp
!mydata
To use '*
' (instead of '*/
') is a bit too much in this instance: it would ignore all files and directories...
精彩评论