From: Eric Blake <eblake@redhat.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Johannes Sixt <j6t@kdbg.org>, git@vger.kernel.org
Subject: Re: [PATCH] Documentation: enhance gitignore whitelist example
Date: Tue, 05 Apr 2011 15:49:26 -0600 [thread overview]
Message-ID: <4D9B8E66.2010408@redhat.com> (raw)
In-Reply-To: <20110405214114.GA13729@elie>
[-- Attachment #1: Type: text/plain, Size: 2822 bytes --]
On 04/05/2011 03:41 PM, Jonathan Nieder wrote:
> Eric Blake wrote:
>
>> Yeah, but then you have to 'git add -f path/to/file' them every time you
>> change them
>
> No, I don't believe that's true.
>
> $ git add -f git.o
> $ >git.o
> $ git add git.o
Aha - it's that pesky dir/ vs. dir/* biting me, yet again:
$ mkdir -p /tmp/blah
$ cd /tmp/blah
$ git init
Initialized empty Git repository in /tmp/blah/.git/
$ mkdir sub
$ > sub/file
$ git add sub/file
$ git commit -a -m 'one'
[master (root-commit) 645ee5a] one
0 files changed, 0 insertions(+), 0 deletions(-)
create mode 100644 sub/file
$ printf 'sub/*\n!sub/file\n' > .gitignore
$ touch sub/file2
$ echo hi > sub/file
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: sub/file
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
no changes added to commit (use "git add" and/or "git commit -a")
$ git add sub
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sub/file
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
$ git reset
Unstaged changes after reset:
M sub/file
$ printf 'sub/\n!sub/file\n' > .gitignore
$ git add sub
The following paths are ignored by one of your .gitignore files:
sub
Use -f if you really want to add them.
fatal: no files added
$ git add sub/file
The following paths are ignored by one of your .gitignore files:
sub
Use -f if you really want to add them.
fatal: no files added
$ git status
# On branch master
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: sub/file
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .gitignore
no changes added to commit (use "git add" and/or "git commit -a")
$ git add .
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: .gitignore
# modified: sub/file
#
>
> .gitignore only protects against starting to track a file that was
> previously untracked.
Not quite. When filtering a directory, it also protects against changes
to tracked files in that directory. And that is what has been throwing
me off, which is why we need a doc change (or possibly even a behavior
change).
--
Eric Blake eblake@redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 619 bytes --]
next prev parent reply other threads:[~2011-04-05 21:49 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 19:36 [PATCH] Documentation: enhance gitignore whitelist example Eric Blake
2011-04-05 19:40 ` Jonathan Nieder
2011-04-05 21:15 ` Johannes Sixt
2011-04-05 21:23 ` Eric Blake
2011-04-05 21:41 ` Jonathan Nieder
2011-04-05 21:49 ` Eric Blake [this message]
2011-04-05 21:51 ` Junio C Hamano
2011-04-05 21:39 ` Junio C Hamano
2011-04-05 20:56 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4D9B8E66.2010408@redhat.com \
--to=eblake@redhat.com \
--cc=git@vger.kernel.org \
--cc=j6t@kdbg.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).