gitignore

Is it possible to stop tracking local changes to a file that you *do* want to be pulled down if changed in the repo?

你说的曾经没有我的故事 提交于 2019-12-01 06:53:33
问题 We have a config file in the repo which all the users contribute to based on their function. For my local testing, I need to manually change two values in that config file, but I never want my changes committed back to the server. I do however want to pull updates to the file if there's a newer version in the repo, even if that means my local changes will be overwritten. That's fine, I can just make them again from a stash I created specifically to do exactly that. What I'm wondering is if I

Git: ignore files but not sub-directories in a directory

泪湿孤枕 提交于 2019-12-01 05:48:13
I have a project in which all development is done at some directory depth, and so I'm used to cd-ing to a second-level directory and write some temporary files there. The tree looks like this: repo .git/ project/ dev/ important_stuff/ more_stuff/ README prod/ important_stuff/ more_stuff/ README temp_1.txt test.cc I would like to git-ignore exactly files that are directly in project/ - temp_1.txt and test.cc in this case. How can I do this? You can do the following: project/* !project/*/ This will ignore all files in project but unignore all directories in project . You'll need to ignore:

Multiple Git repositories in one directory

。_饼干妹妹 提交于 2019-12-01 03:15:50
I would like to deploy a directory to multiple developers having different permissions. So this is one thing Git cannot do. What about creating two repositories in one directory and assigning them different file lists by excluding files managed by the other repository with the .gitignore file. Example: /www/project/.git for all files except in /www/project/css /www/project/css/.git -> only files in this directory Has anyone tried this solution? Or are there any better ways to handle this issue? A less annoying approach than git-submodules (which are a pain to use) is gitslave Gitslave creates

.gitignore ignoring whitelisted folder

无人久伴 提交于 2019-12-01 02:58:37
问题 I have a folder that shouldn't be ignored according my .gitignore, but git is still ignoring it. I cannot find any other .gitignore file or git configuration that would suggest this folder be ignored, and git check-ignore is printing nothing. My .gitignore is organized like a whitelist: * !.gitignore !NotIgnoredFolder/ !SomeOtherFolderInRoot I have a folder along the lines of NotIgnoredFolder/subfolder/js, that git is ignoring. Based on its location and my .gitignore, this path obviously

Are leading asterisks “**/” redundant in .gitignore path matching syntax?

最后都变了- 提交于 2019-12-01 02:11:49
问题 Are there any usages that can't be replaced by equivalents without asterisks? Two consecutive asterisks ("**") in patterns matched against full pathname may have special meaning: A leading "**" followed by a slash means match in all directories. For example, "**/foo" matches file or directory "foo" anywhere, the same as pattern "foo". "**/foo/bar" matches file or directory "bar" anywhere that is directly under directory "foo". A trailing "/**" matches everything inside. For example, "abc/**"

How do I Gitnore all files except two subdirectories?

我的未来我决定 提交于 2019-12-01 02:04:05
How do I ignore all files in a project except two subdirectories? I don't want to include all of Wordpress in Git, but I do want to include the customized themes. I have two sibling directories so I don't want two separate Git projects either. .gitignore src/ !src/wp-content/themes/chocolat-child/ !src/wp-content/themes/theme2 It is a fresh repository initialization with no history or commits. When I check status, it is ignoring the subdirectories. >git status # Initial commit # Untracked files: # (use "git add <file>..." to include in what will be committed) # .gitignore # .project #

How do I Gitnore all files except two subdirectories?

♀尐吖头ヾ 提交于 2019-11-30 21:12:28
问题 How do I ignore all files in a project except two subdirectories? I don't want to include all of Wordpress in Git, but I do want to include the customized themes. I have two sibling directories so I don't want two separate Git projects either. .gitignore src/ !src/wp-content/themes/chocolat-child/ !src/wp-content/themes/theme2 It is a fresh repository initialization with no history or commits. When I check status, it is ignoring the subdirectories. >git status # Initial commit # Untracked

Tell git never to update a file

冷暖自知 提交于 2019-11-30 21:04:59
I have a few files in git (namely configure files), that I need to be in the git repo, but I don't want them to ever update (for some reason, running them, and make, changes the configure file). So is there any way I can tell git to ignore any CHANGES to the file, but to keep the original file still in the repo? Currently the only way I've found out to do something like this is to add the file to the .gitignore file, and the git add the file to the project directly (using -f to override). Is there any better way? I wouldn't manage those files with git at all. I'd put them in your .gitignore so

Can I gitignore files with a prefix?

微笑、不失礼 提交于 2019-11-30 20:16:36
I have file a.css and b.css in the same folder. My framework combines those files in a file called temp.a12cab4598347b07f0079d.css This file will be generated wherever there is a css file, so folder matching is no good. Can I ignore all these files using something like temp.*.css Thank you It will work as expected. Also, if you need to do this recursively in any subdirectory **/temp.*.css Yes, that works just fine. The wildcard character in the middle of your string works well. A great reference for gitignore patterns, matching, and rules is the official documentation on gitignore . 来源: https:

Ignore symbolic links in .gitignore

烈酒焚心 提交于 2019-11-30 18:43:33
Is it possible to tell Git to ignore symlinks ? I'm working with a mixed Linux / Windows environment and, as you know, symlinks are handled very differently between the two. Use git version >= 1.6 Git used to treat sym-links the same as regular files, but newer git versions (>= 1.6) check if a file is beyond a symbolic link and will throw a fatal error. e.g.: # git init # mkdir newdir # touch newdir/foo # git add newdir/foo # git commit -m 'add foo' # mv newdir /tmp/ # ln -s /tmp/newdir # touch newdir/bar # git add newdir/bar fatal: 'newdir/bar' is beyond a symbolic link # git add/tmp/newdir