gitignore

Removing .xcuserstate and DS_Store files from git

人走茶凉 提交于 2019-11-29 20:29:23
In Xcode I noticed that .DS_Store and *.xcuserstate always change and don't need to be commited. So, I wrote a .gitignore file that contains this: .DS_Store *.xcuserstate among other entries. Then I used: git rm --cached *xcuserstate git rm ---cached .DS_Store To remove the these file types already under version control. However, when I go to merge Xcode tells me that there are changes that need to be committed. Those changes include .DS_Store files and .xcuserstate files. So, I tried this: How can I Remove .DS_Store files from a Git repository? find . -name .DS_Store -print0 | xargs -0 git rm

Git ignore: How to match one or more digits

淺唱寂寞╮ 提交于 2019-11-29 19:51:54
问题 I would like to make sure that git ignores any log files that are created on a rotating basis. For instance debug.log debug.log.1 debug.log.2 debug.log.10 should all be ignored. I am currently using *.log and *.log.[0-9] to ignore the first 3 in the list. To capture the third, I know I could use *.log.[0-9][0-9] . However, I'd prefer to find a one line solution that could capture all of these. Is there a way to tell the gitignore file to match one or more digits? 回答1: Sadly but .gitigore use

How to tell git to ignore all further edit to a single file without removing it from the repo

孤街醉人 提交于 2019-11-29 19:46:46
I have forked a project on github and started messing around with it on my own machine, I want to commit the changes I have made back to my fork on github but without commiting the changes I have made to the .cfg file, since this contains things like db password etc Use this: git update-index --skip-worktree path/file.cfg And to restore: git update-index --no-skip-worktree path/file.cfg Lastly, if you want to list files that are marked with skip-worktree : git ls-files -v | grep ^S | awk '{print $2}' To simplify, you can make an alias for that in your $HOME/.gitconfig : [alias] ls-ignored

When to use leading slash in gitignore

可紊 提交于 2019-11-29 19:13:32
I'm trying to understand more clearly the .gitignore syntax, and in particular as far as https://github.com/github/gitignore gitignores are concerned. I see that the leading slash is used to match only pathnames relative to the location of the .gitignore file (from http://git-scm.com/docs/gitignore ): A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". But what happens when i remove the leading slash? As far as what i understood, there are two cases: If the pattern does not contain a slash (or it contains only a

git add all except ignoring files in .gitignore file

一笑奈何 提交于 2019-11-29 19:04:04
I am adding source control to a project that had none. The problem is that there are a lot of files to initially add to git with a .gitignore file, but I can't figure out how to add all files without including the files matching something in the .gitignore file. git add * The above command will not add any files because it detects files which are ignored by the .gitignore . git add -f * The above command will add all files including the files I wish to ignore. So, how do I add all files while still adhering to the .gitignore file? I think you mean git add . which will add all of the files to

Add newly created specific folder to .gitignore in Git

拈花ヽ惹草 提交于 2019-11-29 18:59:07
I had a clean working directory and brought in a clone from a Git repo last night. But now my local server created and contains a stats folder which I want to ignore. I can't seem to get Git to ignore this folder when I run a git status. On branch master Your branch is ahead of 'origin/master' by 1 commit. Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: app_public/views/pages/privacy.php new file: app_public/views/pages/terms.php new file: public_html/stats/ctry_usage_200908.png new file: public_html/stats/daily_usage_200908.png new file: public_html/stats/dns

Android studio - should the entire .idea directory be in git ignore?

拈花ヽ惹草 提交于 2019-11-29 18:55:40
I saw a lot of examples for .gitignore files for AndroidStudio , some have .idea in them, and some don't. Is there a good reason not to add the entire .idea dir to .gitignore? If it should not be completely ignored, are there specific files inside .idea (such as .iml) that should be in .gitignore? You can take a look at this page : IntelliJ doc about project configuration files In the "Directory-based format", a particular line is interesting : The .idea directory contains a set of configuration files (.xml). Each file contains only a portion of configuration data pertaining to a certain

Should bower_components be gitignored?

笑着哭i 提交于 2019-11-29 18:53:57
Would it be good practice to keep only the bower.json file and gitignore the whole bower_components directory? The official Bower page stated: N.B. If you aren't authoring a package that is intended to be consumed by others (e.g., you're building a web app), you should always check installed packages into source control . Make sure to check out the link in the quote, it discusses some pro and cons. The main pro it mentions is that checking them in ensures that your dependencies are always available, as long as your repository is available. No matter what happens to Bower, GitHub or whatever

.gitignore all the .DS_Store files in every folder and subfolder

做~自己de王妃 提交于 2019-11-29 18:31:13
I've added .DS_Store to the .gitignore file, but it seems that it is only ignoring .DS_Store in the root directory, not in every folder and subfolder. How do I fix this? I think the problem you're having is that in some earlier commit, you've accidentally added .DS_Store files to the repository. Of course, once a file is tracked in your repository, it will continue to be tracked even if it matches an entry in an applicable .gitignore file. You have to manually remove the .DS_Store files that were added to your repository. You can use git rm --cached .DS_Store . Once removed, git should ignore

git add only modified changes and ignore untracked files

三世轮回 提交于 2019-11-29 18:31:06
I ran "git status" and listed below are some files that were modified/or under the heading "changes not staged for commit". It also listed some untracked files that I want to ignore (I have a ".gitignore" file in these directories). I want to put the modified files in staging so I can commit them. When I ran "git add .", it added the modified files AND the files I want to ignore to staging. How do I add only the modified files and ignore the untracked files if presented with the git status below. Also, are my ".gitignore" files working properly? $ git status # On branch addLocation # Changes