开发者

How to ignore .gitignore file from commiting by EGit plugin of Apatana Studio 2?

I have been using the Git bash for doing my commits until now and have never seen .giti开发者_运维技巧gnore file getting commited. Recently I moved over to Aptana Studio 2 for doing my projects and installed the EGit Eclipse Plugin for version control. Whenever I commit now the .gitignore file also gets commited. I even tried to include the line *.gitignore in the .gitignore file itself, but that doesn't help.

How can I ignore the .gitignore file?


.gitignore should always be versioned with your project files to avoid, that someone else (or youself on another system) accidentally commit files, that may cause serious problems (e.g. files containing passwords, ..). If you want to exclude files, that are very specific to your local environment, you should place them somewhere else.

http://git-scm.com/docs/gitignore

In $GIT_DIR/info/exclude you can write the filenames, that should be ignored and that are specific to that project. In the file defined by core.excludesfile you can place files, that should be ignored in a more global way. Both files are (usually) not versioned.


The actual answer to your question is (assuming the .gitignore file you are referring to is in the root of your project structure):

A.) If you're using windows make sure that .gitignore isn't a hidden file. Right click on the file in Windows Explorer and select properties, then make sure hidden isn't checked off. This has to do with an issue Eclipse based IDEs have with hidden files.

B.) Edit .gitignore and add the following on a line by itself: /.gitignore

C.) Save the file then right click on it in Aptana and click on untrack under the team menu.

EGit should now parse the file as expected but not add it to version control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜