gitignore

Definitive retroactive .gitignore (how to make Git **properly forget** (historically) about a file now in .gitignore)

左心房为你撑大大i 提交于 2019-11-26 14:40:47
问题 Note : This question attempts to clear the confusion regarding applying .gitignore retroactively , not just to the present/future. 1 If you think this is a valuable question, please upvote it! Rationale I've been searching for a way to make my current .gitignore be retroactively enforced, as if I had created .gitignore in the first commit . A proper solution: Will NOT require manually specifying files Will NOT require a commit Will apply retroactively to all commits of all branches Will

.gitignore after commit

元气小坏坏 提交于 2019-11-26 14:02:44
I have a git repository hosted on Github. After committing many files, I am realizing that I need to create .gitignore and exclude .exe , .obj files. However, will it automatically remove these committed files from the repository? Is there any way to force that? No you cannot force a file that is already committed in the repo to be removed just because it is added to the .gitignore You have to git rm --cached to remove the files that you don't want in the repo. ( --cached since you probably want to keep the local copy but remove from the repo. ) So if you want to remove all the exe's from your

working with .git/info/exclude too late

馋奶兔 提交于 2019-11-26 13:57:31
问题 I usually do this: git init git add . git commit . And then I realize that it's about to add my nbproject directory, which I want excluded/ignored. Sometimes, I even check in this directory. Had I added it to .git/info/exclude before running git add., everything works fine (it's excluded). So then I modify .git/info/exclude and then it's too late. git no longer respects changes to .git/info/exclude. So the questions are: How can I get git to take up the changes in the exclude file in the

How to create a .gitignore file

六眼飞鱼酱① 提交于 2019-11-26 13:54:39
I need to add some rules to my .gitignore file. However, I can't find it in my project folder. Isn't it created automatically by Xcode? If not, what command allows me to create one? ajcw If you're using Windows it will not let you create a file without a filename in Windows Explorer. It will give you the error " You must type a file name " if you try to rename a text file as .gitignore To get around this I used the following steps Create the text file gitignore.txt Open it in a text editor and add your rules, then save and close Hold SHIFT, right click the folder you're in, then select Open

How to remove files that are listed in the .gitignore but still on the repository?

我们两清 提交于 2019-11-26 12:33:37
问题 I have some files in my repository that should be ignored, i added them to the .gitignore but, of course, they are not removed from my repository. So my question is, is there a magic command or script using filter-branch that can rewrite my history and remove all these files easily? Or simply a command that will create a commit that will remove them ? 回答1: You can remove them from the repository manually: git rm --cached file1 file2 dir/file3 Or, if you have a lot of files: git rm --cached

What to gitignore from the .idea folder?

夙愿已清 提交于 2019-11-26 11:44:07
问题 Possible Duplicate: Intellij Idea 9/10, what folders to check into (or not check into) source control? I started using WebStorm for web development and am not sure what to add and what to exclude from our Git repository. Clearly some files inside the .idea folder are meant to be version controlled like the external library settings ( jsLibraryMappings.xml ) but others will probably change very often and are developer-specific (e.g., workspace.xml ). What is the recommended .gitignore pattern

How can I stop .gitignore from appearing in the list of untracked files?

非 Y 不嫁゛ 提交于 2019-11-26 11:27:27
I just did a git init on the root of my new project. Then I created a .gitignore file. Now, when I type git status , .gitignore file appears in the list of untracked files. Why is that? August Lilleaas The .gitignore file should be in your repository, so it should indeed be added and committed in, as git status suggests. It has to be a part of the repository tree, so that changes to it can be merged and so on. So, add it to your repository, it should not be gitignored. If you really want you can add .gitignore to the .gitignore file if you don't want it to be committed. However, in that case

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

会有一股神秘感。 提交于 2019-11-26 11:01:37
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/mongolab/tractorpush-server (source) It instructed me to add node_modules to .gitignore. So I removed

How do I tell Git to ignore everything except a subdirectory?

我怕爱的太早我们不能终老 提交于 2019-11-26 10:15:06
I want to ignore all files in my repository except those that occur in the bin subdirectory. I tried adding the following to my .gitignore : * !bin/* This does not have the desired effect, however: I created a new file inside of bin/ , but doing git status still shows nothing to commit (working directory clean) . Any suggestions? This ignores root files & root directories, then un-ignores the root bin directory: /* /*/ !/bin/ This way you get all of the bin directory, including subdirectories and their files. Here how to ignore everything exept one directory " MY_SUPER_DUPER_TEMPLATE_directory

gitignore without binary files

懵懂的女人 提交于 2019-11-26 10:09:56
问题 How can binary files be ignored in git using the .gitignore file? Example: $ g++ hello.c -o hello The \"hello\" file is a binary file. Can git ignore this file ? 回答1: # Ignore all * # Unignore all with extensions !*.* # Unignore all dirs !*/ ### Above combination will ignore all files without extension ### # Ignore files with extension `.class` & `.sm` *.class *.sm # Ignore `bin` dir bin/ # or */bin/* # Unignore all `.jar` in `bin` dir !*/bin/*.jar # Ignore all `library.jar` in `bin` dir *