gitignore

Difference in the paths in .gitignore file?

半世苍凉 提交于 2019-11-27 00:02:41
I've been using git but still having confusion about the .gitignore file paths. So, what is the difference between the following two paths in .gitignore file? tmp/* public/documents/**/* I can understand that tmp/* will ignore all the files and folders inside it. Am I right? But what does that second line path mean? This depends on the behavior of your shell. Git doesn't do any work to determine how to expand these. In general, * matches any single file or folder: /a/*/z matches /a/b/z matches /a/c/z doesn't match /a/b/c/z ** matches any string of folders: /a/**/z matches /a/b/z matches /a/b/c

Add .gitignore to gitignore

左心房为你撑大大i 提交于 2019-11-26 23:55:56
问题 Is it possible to add the .gitignore file to .gitignore itself? .gitignore Doesn't work though I don't want to see it in edited files 回答1: The .gitignore file's purpose is to prevent everyone who collaborates on a project from accidentally commiting some common files in a project, such as generated cache files. Therefore you should not ignore .gitignore , since it's supposed to be included in the repository. If you want to ignore files in just one repository but want to avoid committing the

git ignore all files of a certain type, except those in a specific subfolder

微笑、不失礼 提交于 2019-11-26 23:49:49
问题 I have a directory structure like this: root folder1 abc.json def.json somedir more.json folder2 qwe.json rty.json spec mock1.json mock2.json somedir more_mocks.json Now using a .gitignore I want to ignore all *.json files except for the ones in the spec . I don't want to use a .gitignore in folder1 and folder2 because there are a ton of these and they will get added to a lot, and i'm sure I will forget to move the right .gitignore file in place. In addition there may be more nested

git ignore exception

痴心易碎 提交于 2019-11-26 23:47:45
I have a gitignore file that makes git ignore *.dll files, and that is actually the behavior I want. However, if I want an exception ( i.e. to be able to commit foo.dll ), how can I achieve this? Use: *.dll #Exclude all dlls !foo.dll #Except for foo.dll From gitignore : An optional prefix ! which negates the pattern; any matching file excluded by a previous pattern will become included again. If a negated pattern matches, this will override lower precedence patterns sources. Git ignores folders if you write: /js but it can't add exceptions if you do: !/js/jquery or !/js/jquery/ or !/js/jquery/

Force add despite the .gitignore file

丶灬走出姿态 提交于 2019-11-26 23:30:45
Is there a way to force git to add a file despite the .gitignore file? See man git-add : -f, --force Allow adding otherwise ignored files. So run this git add --force my/ignore/file.foo A-S Despite Daniel Böhmer's working solution, Ohad Schneider offered a better solution in a comment: If the file is usually ignored, and you force adding it - it can be accidentally ignored again in the future (like when the file is deleted, then a commit is made and the file is re-created. You should just un-ignore it in the .gitignore file like that: Unignore subdirectories of ignored directories in Git

Typical .gitignore file for an Android app

北城以北 提交于 2019-11-26 22:28:54
问题 Just put an Android project under git ( beanstalk ) version control via the command line ( mac terminal ). Next step is to set up exclusions. To those of you who have already been down this path: What should a typical .gitignore file look like for an android project? Project set up in Eclipse 回答1: You can mix Android.gitignore: # built application files *.apk *.ap_ # files for the dex VM *.dex # Java class files *.class # generated files bin/ gen/ # Local configuration file (sdk path, etc)

Why git rm --cached not remove local ever tracked file but others

别来无恙 提交于 2019-11-26 21:57:23
问题 When untrack a file in the git repository, use git rm -r --cached . . This will not remove the ever tracked file in local storage, but when other developers fetch this commit with git pull , the ever tracked file will been removed on their machine storage. You can reproduce it with: save current work. ( Machine A ) git add . git stash save "work position" create a new file and commit it.( Machine A ) echo hello>>file_not_to_track git add . git commit -m "add file file_not_to_track" pull from

How to manage configuration files when collaborating?

心不动则不痛 提交于 2019-11-26 21:55:17
I'm writing a short script with a few simple variables at the top of the page. I want to work on them with a friend, but we aren't sure how to manage the variables needing to be changed after pulling each time for one of us, adding unnecessary junk to git status. I thought about just creating different named branches for each of us, and then the master will just have example usernames set, but it seems silly to have to do all that extra work merging. We could have the variables passed to the script as options, but that isn't desired, nor is separating it out to another separate configuration

What's the difference between Git ignoring directory and directory/*?

三世轮回 提交于 2019-11-26 21:54:40
I'm confused about what's the correct way to ignore the contents of a directory in git. Assume I have the following directory structure: my_project |--www |--1.txt |--2.txt |--.gitignore What's the difference between putting this: www And this? www/* The reason I'm asking this question is: In git, if a directory is empty, git won't include such empty directory in repository. So I was trying the solution that is add an extra .gitkeep file under the directory so that it won't be empty. When I was trying that solution, if in the .gitignore file, I write like below: www !*.gitkeep It doesn't work

Best practices for adding .gitignore file for Python projects? [closed]

房东的猫 提交于 2019-11-26 21:23:41
I'm trying to collect some of my default settings, and one thing I realized I don't have a standard for is .gitignore files. There's a great thread showing a good .gitignore for Visual Studio projects , but I don't see many recommendations for Python and related tools (PyGTK, Django). So far, I have... *.pyc *.pyo ...for the compiled objects and... build/ dist/ ...for the setuptools output. What are some best practices for .gitignore files, and where can I go for more about these best practices? When using buildout I have following in .gitignore (along with *.pyo and *.pyc ): .installed.cfg