How can I ignore directories or folders in Git using msysgit on Windows?
相关问题
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
- I want to trace logs using a Macro multi parameter
相关文章
- 请教Git如何克隆本地库?
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- GitHub:Enterprise post-receive hook
- Git Clone Fails: Server Certificate Verification F
Just in case you need to exclude sub folders you can use the
**
wildcard to exclude any level of sub directory.In Windows there's an extra catch with slashes. Excluding a single directory in .gitignore with
will possibly work, but excluding all directories with
causes problems when you have file names with spaces (like
my file.txt
) in your directory: Git bash escapes these spaces with a backslash (likemy\ file.txt
) and Git for Windows doesn't distinguish between/
and\
.To exclude all directories better use:
Two consecutive asteriscs signify directory contents.
You can create the ".gitignore" file with the contents:
It works for me and simples.
If you want to maintain a folder and not the files inside it, just put a ".gitignore" file in the folder with "*" as content. This file will ignore all content from repository. But
.gitignore
will be include in your repo.If you add empty folder, you receive this message (.gitignore is hidden file)
So, use "-f" to force add:
I had similar issues, I work on a windows tool chain with a shared repo with linux guys, they happlily create files with the same [except for case] names in a given folder.
The effect is that I can clone the repo and immediatly have dozens of 'modified' files that if I checked in would create havoc.
I have windows set to case sensitive and git to not ignore case but it still fails (in the win32 api calls apparently).
If I gitignore the files then I have to remember to not track the .gitignore file.
But I found a good answer here http://archive.robwilkerson.org/2010/03/02/git-tip-ignore-changes-to-tracked-files/index.html
Chris
When everything else fails try editing the file
and adding the directories you want to the end of the file, like this:
I added the folders "assets" and "compiled" to the list of files and directories to ignore.