git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* .gitignore vs untracked working file
@ 2009-08-10  9:57 Rostislav Svoboda
  2009-08-10 10:01 ` Uwe Kleine-König
  0 siblings, 1 reply; 7+ messages in thread
From: Rostislav Svoboda @ 2009-08-10  9:57 UTC (permalink / raw)
  To: git

Hi

I have a .gitignore rule to ignore everything in bin/ directories but
I cannot change branch because of a file lying in a bin/ directory
which actually should be ignored. What am I doing wrong?

$ git branch
  master
* mybranch

$ git status
# On branch mybranch
nothing to commit (working directory clean)

$ cat .gitignore
*.class
.cvsignore
CVS/
.metadata/
build/
bin/
.#*

$ git checkout master
error: Untracked working tree file 'Project/bin/path/file.jjt' would
be overwritten by merge.

$ git --version
git version 1.6.4.msysgit.0


thx

Bost

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

* Re: .gitignore vs untracked working file
  2009-08-10  9:57 .gitignore vs untracked working file Rostislav Svoboda
@ 2009-08-10 10:01 ` Uwe Kleine-König
  2009-08-10 10:17   ` Rostislav Svoboda
  0 siblings, 1 reply; 7+ messages in thread
From: Uwe Kleine-König @ 2009-08-10 10:01 UTC (permalink / raw)
  To: Rostislav Svoboda; +Cc: git

Hello,

> $ git checkout master
> error: Untracked working tree file 'Project/bin/path/file.jjt' would
> be overwritten by merge.
What is the output of

	$ git ls-files master bin/

?

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* Re: .gitignore vs untracked working file
  2009-08-10 10:01 ` Uwe Kleine-König
@ 2009-08-10 10:17   ` Rostislav Svoboda
  2009-08-10 11:41     ` Johannes Sixt
  0 siblings, 1 reply; 7+ messages in thread
From: Rostislav Svoboda @ 2009-08-10 10:17 UTC (permalink / raw)
  To: git, Uwe Kleine-König

2009/8/10 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> Hello,
>
>> $ git checkout master
>> error: Untracked working tree file 'Project/bin/path/file.jjt' would
>> be overwritten by merge.
> What is the output of
>
>        $ git ls-files master bin/

Nothing:

$ git ls-files master bin/
$ git ls-files master Project/bin/
$ git ls-files mybranch bin/
$ git ls-files mybranch Project/bin/

$ ll 'Project/bin/path/file.jjt'
-rw-r--r--    1 bost  Administ     8233 May 10  2006 Project/bin/path/file.jjt
$ git ls-files ''Project/bin/path/file.jjt'

BTW the rule to ignore bin/ is exclusively in the .gitignore on the
branch mybranch not in the master branch. Might this be the problem?

Bost

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

* Re: .gitignore vs untracked working file
  2009-08-10 10:17   ` Rostislav Svoboda
@ 2009-08-10 11:41     ` Johannes Sixt
  2009-08-10 12:59       ` Rostislav Svoboda
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2009-08-10 11:41 UTC (permalink / raw)
  To: Rostislav Svoboda; +Cc: git, Uwe Kleine-König

Rostislav Svoboda schrieb:
> 2009/8/10 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
>> Hello,
>>
>>> $ git checkout master
>>> error: Untracked working tree file 'Project/bin/path/file.jjt' would
>>> be overwritten by merge.
>> What is the output of
>>
>>        $ git ls-files master bin/
> 
> Nothing:

It should have been

	$ git ls-tree master bin

> BTW the rule to ignore bin/ is exclusively in the .gitignore on the
> branch mybranch not in the master branch. Might this be the problem?

It might be, depending on how precious Project/bin/path/file.jjt is for
you. Try this:

	$ git checkout -f master

This will overwrite the existing file with the version from master. If you
later

	$ git checkout mybranch

then the file will be *removed*.

-- Hannes

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

* Re: .gitignore vs untracked working file
  2009-08-10 11:41     ` Johannes Sixt
@ 2009-08-10 12:59       ` Rostislav Svoboda
  2009-08-10 13:14         ` Johannes Sixt
  0 siblings, 1 reply; 7+ messages in thread
From: Rostislav Svoboda @ 2009-08-10 12:59 UTC (permalink / raw)
  To: Johannes Sixt, git, Uwe Kleine-König

2009/8/10 Johannes Sixt <j.sixt@viscovery.net>:
> Rostislav Svoboda schrieb:
>> 2009/8/10 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
>>> Hello,
>>>
>>>> $ git checkout master
>>>> error: Untracked working tree file 'Project/bin/path/file.jjt' would
>>>> be overwritten by merge.
>>> What is the output of
>>>
>>>        $ git ls-files master bin/
>>
>> Nothing:
>
> It should have been
>
>        $ git ls-tree master bin

Merde!

$ git ls-tree master Project/bin/path/file.jjt
100644 blob 8d5e24f12c37fd1a435de2d4402591f5b0c2a3cc
Project/bin/path/file.jjt

There's a file.jjt in the repo already! But guys! I bet I'm not the
first one having this problem. Do you think it would be wise to have a
kind of a check returning
    'The file '...' ignored in the branch X is not ignored in the
branch Y (or something)'

instead of responding questions like mine over and over again?

Bost

PS: ... and yea, thx a lot!

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

* Re: .gitignore vs untracked working file
  2009-08-10 12:59       ` Rostislav Svoboda
@ 2009-08-10 13:14         ` Johannes Sixt
  2009-08-10 13:49           ` Rostislav Svoboda
  0 siblings, 1 reply; 7+ messages in thread
From: Johannes Sixt @ 2009-08-10 13:14 UTC (permalink / raw)
  To: Rostislav Svoboda; +Cc: git, Uwe Kleine-König

Rostislav Svoboda schrieb:
> $ git ls-tree master Project/bin/path/file.jjt
> 100644 blob 8d5e24f12c37fd1a435de2d4402591f5b0c2a3cc
> Project/bin/path/file.jjt
> 
> There's a file.jjt in the repo already! But guys! I bet I'm not the
> first one having this problem. Do you think it would be wise to have a
> kind of a check returning
>     'The file '...' ignored in the branch X is not ignored in the
> branch Y (or something)'

This is not only about ignored files, but untracked files. And the check
is already there: git said:

Untracked working tree file 'Project/bin/path/file.jjt' would be
overwritten by merge.

-- Hannes

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

* Re: .gitignore vs untracked working file
  2009-08-10 13:14         ` Johannes Sixt
@ 2009-08-10 13:49           ` Rostislav Svoboda
  0 siblings, 0 replies; 7+ messages in thread
From: Rostislav Svoboda @ 2009-08-10 13:49 UTC (permalink / raw)
  To: Johannes Sixt, git

> This is not only about ignored files, but untracked files. And the check
> is already there: git said:
>
> Untracked working tree file 'Project/bin/path/file.jjt' would be
> overwritten by merge.

Well the meaning of the error message is clear to you but it wasn't
for me. I simply would not ask if I knew how to correctly interpret
it. I hope I'll have a time to make a little improvement here...

Bost

PS: ...and you can reject it if you don't agree :-)

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

end of thread, other threads:[~2009-08-10 13:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-10  9:57 .gitignore vs untracked working file Rostislav Svoboda
2009-08-10 10:01 ` Uwe Kleine-König
2009-08-10 10:17   ` Rostislav Svoboda
2009-08-10 11:41     ` Johannes Sixt
2009-08-10 12:59       ` Rostislav Svoboda
2009-08-10 13:14         ` Johannes Sixt
2009-08-10 13:49           ` Rostislav Svoboda

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).