git-ignore misses

Asked by Stas Sușcov

Binary package hint: git-core

No gitignore tool in current jaunty repositories!!!

Please add gitignore tool:
http://www.kernel.org/pub/software/scm/git/docs/gitignore.html

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu git-core Edit question
Assignee:
No assignee Edit question
Solved by:
Anders Kaseorg
Solved:
Last query:
Last reply:

This question was originally filed as bug #341126.

Revision history for this message
Anders Kaseorg (andersk) said :
#1

There is no “gitignore” or “git-ignore” tool. You just create a text file named “.gitignore” or “.git/info/exclude” in your Git clone with a list of files to ignore, one per line. See the SYNPOSIS section of the documentation that you linked to.

Revision history for this message
Stas Sușcov (sushkov) said :
#2

Ok, then what I'm doing wrong?
:(

-------------------------------------------------------
21:28:00 stas@kyoto:~/Documents/code.c7obs.net/intranet >cat config/.gitignore
*.php
21:28:13 stas@kyoto:~/Documents/code.c7obs.net/intranet >cat .git/info/exclude
# git-ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~

config/*
tmp/*
21:32:08 stas@kyoto:~/Documents/code.c7obs.net/intranet >cat .gitignore
config/*
tmp/*
21:28:22 stas@kyoto:~/Documents/code.c7obs.net/intranet >git status
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# deleted: .gitignore
# modified: config/database.php
# deleted: webroot/test.php
#
no changes added to commit (use "git add" and/or "git commit -a")
21:28:35 stas@kyoto:~/Documents/code.c7obs.net/intranet >
-------------------------------------------------------------------------------------------

I can't make it in any way to leave some files untracked...

P.S.: Should I move it to Answers/Questions section?

Revision history for this message
Stas Sușcov (sushkov) said :
#3

The last output actually is this:
21:32:14 stas@kyoto:~/Documents/code.c7obs.net/intranet >git status
# On branch master
# Changed but not updated:
# (use "git add/rm <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: config/database.php
# deleted: webroot/test.php
#
no changes added to commit (use "git add" and/or "git commit -a")

Revision history for this message
Best Anders Kaseorg (andersk) said :
#4

config/database.php is already tracked in your repository, so it cannot be ignored with .gitignore unless you remove it from the repository. From the gitignore(5) documentation:
       A gitignore file specifies intentionally untracked files that git
       should ignore. Note that all the gitignore files really concern only
       files that are not already tracked by git; in order to ignore
       uncommitted changes in already tracked files, please refer to the git
       update-index --assume-unchanged documentation.

Revision history for this message
Stas Sușcov (sushkov) said :
#5

Yes, that worked.

I removed the "config" directory, than commited.
After what, any modifications related to "config" directory, were ignored!

Thank you very much for assistance!
And sorry, for such a dumb question, I should have read the docs better.
:(