.gitignore vs untracked working file

7 messages, 3 authors, 2016-06-15 · open the first message on its own page

.gitignore vs untracked working file

From: Rostislav Svoboda <hidden>
Date: 2016-06-15 22:47:12

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

Re: .gitignore vs untracked working file

From: Uwe Kleine-König <hidden>
Date: 2016-06-15 22:47:12

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/  |

Re: .gitignore vs untracked working file

From: Rostislav Svoboda <hidden>
Date: 2016-06-15 22:47:12

2009/8/10 Uwe Kleine-König [off-list ref]:
Hello,
quoted
$ 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

Re: .gitignore vs untracked working file

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:47:12

Rostislav Svoboda schrieb:
2009/8/10 Uwe Kleine-König [off-list ref]:
quoted
Hello,
quoted
$ 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

Re: .gitignore vs untracked working file

From: Rostislav Svoboda <hidden>
Date: 2016-06-15 22:47:12

2009/8/10 Johannes Sixt [off-list ref]:
Rostislav Svoboda schrieb:
quoted
2009/8/10 Uwe Kleine-König [off-list ref]:
quoted
Hello,
quoted
$ 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!

Re: .gitignore vs untracked working file

From: Johannes Sixt <hidden>
Date: 2016-06-15 22:47:12

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

Re: .gitignore vs untracked working file

From: Rostislav Svoboda <hidden>
Date: 2016-06-15 22:47:12

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 :-)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help