gitignore

Ignore symbolic links in .gitignore

Deadly 提交于 2019-12-30 04:02:16
问题 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. 回答1: 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

.gitignore Doesn't Seem To Work

£可爱£侵袭症+ 提交于 2019-12-29 08:56:08
问题 My .gitignore: .DS_Store /.idea /.idea_modules /out /project /target /*.iml */resolution-cache/* */streams/* */target/* But nonetheless, the folders .idea , .idea_modules and target have appeared in a repo and are still there. Your ideas? 回答1: Ignoring is only useful for files that are not currently being tracked by the repo. If those directories were added to the repo before being put in .gitignore, they will continue to be tracked. Use git rm --cached <file> to stop tracking a file. Of

Python, how to implement something like .gitignore behavior

末鹿安然 提交于 2019-12-29 06:46:49
问题 I need to list all files in the current directory (.) (including all sub directories), and exclude some files as how .gitignore works (http://git-scm.com/docs/gitignore) With fnmatch (https://docs.python.org/2/library/fnmatch.html) I will be able to "filter" files using a pattern ignore_files = ['*.jpg', 'foo/', 'bar/hello*'] matches = [] for root, dirnames, filenames in os.walk('.'): for filename in fnmatch.filter(filenames, '*'): matches.append(os.path.join(root, filename)) how can I

Is there a way to setup remote-specific .gitignores?

喜夏-厌秋 提交于 2019-12-29 04:10:40
问题 Is there a simple way to setup different .gitignore files for different remotes? I have a repository I push up to both Heroku and Github. I need database.yml for Heroku, but don't want some of the information to be pushed up to Github. So I need a different .gitignore file for each of the remotes. I tried having two separate branches, one that ignores database.yml, and one that doesn't. The problem is that when I checkout the heroku branch and go back into my github branch, the entire

add #*# glob to .gitignore?

僤鯓⒐⒋嵵緔 提交于 2019-12-29 03:11:10
问题 I want to add emacs autosave files to my .gitignore with the glob #*# but of course, lines starting with a hash are comment lines. How can I get this into my .gitignore without it being treated as a comment? 回答1: Did you try \#*# Since 1.6.2, \ should be supported in .gitignore (see this patch) To be precise, 1.6.2.1 (March 2009) .gitignore learned to handle backslash as a quoting mechanism for comment introduction character " # ". 回答2: Another way of escaping # is to use the character set

git: have different .gitignore file for each remote

孤人 提交于 2019-12-28 04:58:14
问题 I have a remote repo in which I want to commit certain files (the compiled files to deploy them on a cloud computing platform), but I don't want to deploy them on github... is there some way to have to different .gitignore files, one for each remote? 回答1: This doesn't really make sense in git's model. Commits contain sets of files; all .gitignore files do is tell the UI not to automatically add files matching certain patterns. What this would effectively mean is to have parallel sets of

How to track directories but not their files with Git?

安稳与你 提交于 2019-12-28 03:31:10
问题 I've recently started using Git and am having trouble with just one thing. How can I track directories without tracking their contents? For example the site I'm working on allows uploads. I want to track the uploads directory so that it is created when branching, etc. but obviously not the files within it (test files whilst in develop branch or the real files in master). In my .gitignore I have the following: uploads/*.* Have also tried (which ignores the whole directory): uploads/ This

Can I make a user-specific gitignore file?

白昼怎懂夜的黑 提交于 2019-12-28 01:47:24
问题 I want to change the gitignore, but not everyone on the team wants these changes. How can a user have their own specific git ignore file? 回答1: For user-specific and repo-specific file ignoring you should populate the following file: $GIT_DIR/info/exclude Usually $GIT_DIR stands for: your_repo_path/.git/ 回答2: You can create your own .gitignore using git config --global core.excludesfile $HOME/.gitignore Then put your desired entries in that file. 回答3: In their .gitconfig: [core] excludesfile =

How to .gitignore all files/folder in a folder, but not the folder itself? [duplicate]

夙愿已清 提交于 2019-12-28 01:39:12
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How do I add an empty directory to a git repository I want to check in a blank folder. How can I do this? 回答1: You can't commit empty folders in git. If you want it to show up, you need to put something in it, even just an empty file. For example, add an empty file called .gitkeep to the folder you want to keep, then in your .gitignore file write: # exclude everything somefolder/* # exception to the rule

Should I check in node_modules to git when creating a node.js app on Heroku?

独自空忆成欢 提交于 2019-12-27 10:31:10
问题 I followed the basic getting started instructions for node.js on Heroku here: https://devcenter.heroku.com/categories/nodejs These instruction don't tell you to create a .gitignore node_modules, and therefore imply that node_modules should be checked in to git. When I include node_modules in git my getting started application ran correctly. When I followed the more advanced example at: https://devcenter.heroku.com/articles/realtime-polyglot-app-node-ruby-mongodb-socketio https://github.com