All of lore.kernel.org
 help / color / mirror / Atom feed
* .gitignore behavior on Mac
@ 2013-05-18 18:36 Peter Lauri
  2013-05-18 18:41 ` John Keeping
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Lauri @ 2013-05-18 18:36 UTC (permalink / raw)
  To: git

Shouldn't this be valid? I would expect to NOT see the
core/inc/config.inc.php in the "git status" output...

Peters-MacBook-Air:dt-git plauri$ cat .gitignore
.buildpath
.project
.settings/
web/pjotr.php
core/inc/config.inc.php
dt_error.log
process_wrapper.sh

Peters-MacBook-Air:dt-git plauri$ git status
# On branch local/DT-7_gantt
# 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:   .gitignore
# modified:   core/inc/config.inc.php
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
# out.ionel
# tree.py
no changes added to commit (use "git add" and/or "git commit -a")
Peters-MacBook-Air:dt-git plauri$

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 18:36 .gitignore behavior on Mac Peter Lauri
@ 2013-05-18 18:41 ` John Keeping
  2013-05-18 18:43   ` Peter Lauri
  0 siblings, 1 reply; 8+ messages in thread
From: John Keeping @ 2013-05-18 18:41 UTC (permalink / raw)
  To: Peter Lauri; +Cc: git

On Sat, May 18, 2013 at 08:36:42PM +0200, Peter Lauri wrote:
> Shouldn't this be valid? I would expect to NOT see the
> core/inc/config.inc.php in the "git status" output...
> 
> Peters-MacBook-Air:dt-git plauri$ cat .gitignore
> .buildpath
> .project
> .settings/
> web/pjotr.php
> core/inc/config.inc.php
> dt_error.log
> process_wrapper.sh
> 
> Peters-MacBook-Air:dt-git plauri$ git status
> # On branch local/DT-7_gantt
> # 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:   .gitignore
> # modified:   core/inc/config.inc.php

core/inc/config.inc.php is already in the repository.  Git won't ignore
files that are already tracked.

If you remove the file from the index:

    git rm --cached core/inc/config.inc.php

then you'll see it as deleted in "git status" but it won't appear in the
untracked files section even though it's still there in the working
tree.

> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> # out.ionel
> # tree.py
> no changes added to commit (use "git add" and/or "git commit -a")
> Peters-MacBook-Air:dt-git plauri$
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 18:41 ` John Keeping
@ 2013-05-18 18:43   ` Peter Lauri
  2013-05-18 18:55     ` John Keeping
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Lauri @ 2013-05-18 18:43 UTC (permalink / raw)
  To: John Keeping; +Cc: git

But I just don't want to see that darn file. It is a config file that
I have changed, and I don't want to need to stash it for each "git
svn" action I want to perform... Any solution for that?

On Sat, May 18, 2013 at 8:41 PM, John Keeping <john@keeping.me.uk> wrote:
> On Sat, May 18, 2013 at 08:36:42PM +0200, Peter Lauri wrote:
>> Shouldn't this be valid? I would expect to NOT see the
>> core/inc/config.inc.php in the "git status" output...
>>
>> Peters-MacBook-Air:dt-git plauri$ cat .gitignore
>> .buildpath
>> .project
>> .settings/
>> web/pjotr.php
>> core/inc/config.inc.php
>> dt_error.log
>> process_wrapper.sh
>>
>> Peters-MacBook-Air:dt-git plauri$ git status
>> # On branch local/DT-7_gantt
>> # 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:   .gitignore
>> # modified:   core/inc/config.inc.php
>
> core/inc/config.inc.php is already in the repository.  Git won't ignore
> files that are already tracked.
>
> If you remove the file from the index:
>
>     git rm --cached core/inc/config.inc.php
>
> then you'll see it as deleted in "git status" but it won't appear in the
> untracked files section even though it's still there in the working
> tree.
>
>> # Untracked files:
>> #   (use "git add <file>..." to include in what will be committed)
>> #
>> # out.ionel
>> # tree.py
>> no changes added to commit (use "git add" and/or "git commit -a")
>> Peters-MacBook-Air:dt-git plauri$
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 18:43   ` Peter Lauri
@ 2013-05-18 18:55     ` John Keeping
  2013-05-18 21:01       ` Johannes Sixt
  0 siblings, 1 reply; 8+ messages in thread
From: John Keeping @ 2013-05-18 18:55 UTC (permalink / raw)
  To: Peter Lauri; +Cc: git

On Sat, May 18, 2013 at 08:43:57PM +0200, Peter Lauri wrote:
> But I just don't want to see that darn file. It is a config file that
> I have changed, and I don't want to need to stash it for each "git
> svn" action I want to perform... Any solution for that?

Read about --assume-unchanged in git-update-index(1).

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 18:55     ` John Keeping
@ 2013-05-18 21:01       ` Johannes Sixt
  2013-05-18 22:37         ` Peter Lauri
  0 siblings, 1 reply; 8+ messages in thread
From: Johannes Sixt @ 2013-05-18 21:01 UTC (permalink / raw)
  To: John Keeping; +Cc: Peter Lauri, git

Am 18.05.2013 20:55, schrieb John Keeping:
> On Sat, May 18, 2013 at 08:43:57PM +0200, Peter Lauri wrote:
>> But I just don't want to see that darn file. It is a config file that
>> I have changed, and I don't want to need to stash it for each "git
>> svn" action I want to perform... Any solution for that?
> 
> Read about --assume-unchanged in git-update-index(1).

Beware!! --assume-unchanged is a promise not to modify a file, but that
is not true in this case, because it *was* modified. It might hide the
file from the git-status output, but then git might do something
unexpected sometimes, because a promise was not kept.

See last paragraph of
http://article.gmane.org/gmane.comp.version-control.git/146353

-- Hannes

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 21:01       ` Johannes Sixt
@ 2013-05-18 22:37         ` Peter Lauri
  2013-05-19  7:47           ` Junio C Hamano
  2013-05-19 10:54           ` Antony Male
  0 siblings, 2 replies; 8+ messages in thread
From: Peter Lauri @ 2013-05-18 22:37 UTC (permalink / raw)
  To: Johannes Sixt; +Cc: John Keeping, git

Great, I have gotten the concept now :)

My workaround for my problem is to rename the file to ....default and
then all will work out well :) Copy the file then and locally modify
it, but it will be in .gitignore so not tracked :)

On Sat, May 18, 2013 at 11:01 PM, Johannes Sixt <j6t@kdbg.org> wrote:
> Am 18.05.2013 20:55, schrieb John Keeping:
>> On Sat, May 18, 2013 at 08:43:57PM +0200, Peter Lauri wrote:
>>> But I just don't want to see that darn file. It is a config file that
>>> I have changed, and I don't want to need to stash it for each "git
>>> svn" action I want to perform... Any solution for that?
>>
>> Read about --assume-unchanged in git-update-index(1).
>
> Beware!! --assume-unchanged is a promise not to modify a file, but that
> is not true in this case, because it *was* modified. It might hide the
> file from the git-status output, but then git might do something
> unexpected sometimes, because a promise was not kept.
>
> See last paragraph of
> http://article.gmane.org/gmane.comp.version-control.git/146353
>
> -- Hannes
>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 22:37         ` Peter Lauri
@ 2013-05-19  7:47           ` Junio C Hamano
  2013-05-19 10:54           ` Antony Male
  1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2013-05-19  7:47 UTC (permalink / raw)
  To: Peter Lauri; +Cc: Johannes Sixt, John Keeping, git

Peter Lauri <peterlauri@gmail.com> writes:

> Great, I have gotten the concept now :)
>
> My workaround for my problem is to rename the file to ....default and
> then all will work out well :) Copy the file then and locally modify
> it, but it will be in .gitignore so not tracked :)

I think it is not even an workaround but is a solid software
configuration practice that is recommended.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: .gitignore behavior on Mac
  2013-05-18 22:37         ` Peter Lauri
  2013-05-19  7:47           ` Junio C Hamano
@ 2013-05-19 10:54           ` Antony Male
  1 sibling, 0 replies; 8+ messages in thread
From: Antony Male @ 2013-05-19 10:54 UTC (permalink / raw)
  To: Peter Lauri; +Cc: git

On 18/05/2013 23:37, Peter Lauri wrote:
> Great, I have gotten the concept now :)
>
> My workaround for my problem is to rename the file to ....default and
> then all will work out well :) Copy the file then and locally modify
> it, but it will be in .gitignore so not tracked :)

Over in the #git IRC channel, we point users asking this question to 
https://gist.github.com/canton7/1423106. It contains that approach, and 
quite a few others.

Antony

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-05-19 11:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-18 18:36 .gitignore behavior on Mac Peter Lauri
2013-05-18 18:41 ` John Keeping
2013-05-18 18:43   ` Peter Lauri
2013-05-18 18:55     ` John Keeping
2013-05-18 21:01       ` Johannes Sixt
2013-05-18 22:37         ` Peter Lauri
2013-05-19  7:47           ` Junio C Hamano
2013-05-19 10:54           ` Antony Male

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.