top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration
Print Preview

ls-files -i & directories in git

0 votes
42 views

the gitignore rules work so that if a directory is ignored, all files in that directory are ignored. While that behavior isn't clearly documented in gitignore, this behavior is consistent across all git tools (status, ls-files, ...).

An exception is that listing the ignored files using "ls-files -i" doesn't behave the same way.

example:
$ mkdir d
$ touch d/f
$ echo /d/ > .gitignore
$ git ls-files -o --exclude-standard
.gitignore #d/f is correctly not listed
$ git ls-files -i --exclude-standard
#no output

d/f isn't listed even though it is treated as an ignored file by all other git tools. That seems inconsistent to me. Is that behavior intentionally or is this a bug?

A very similar question was asked before:
http://git.661346.n2.nabble.com/git-ls-files-ignored-and-ignored-directory-tt7570641.html
but without an answer.

posted May 31, 2013 by anonymous

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

It is listed with "git ls-files -i -o --exclude-standard". The documentation says:

Show only ignored files in the output. When showing files in the index, print only those matched by an exclude pattern. When showing "other" files, show only those matched by an exclude pattern.

If you do this then it is shown:

$ git add -f d/f
$ git ls-files -i --exclude-standard
d/f

I think this is working as documented.

answer May 31, 2013 by anonymous
Similar Questions
0 votes

I work on some files and push/merge them to the remote server. Sometimes I get merge conflicts on those files and have to fix them. That's completely fine. I get that.

What I don't understand is that sometimes during this process I will get merge conflicts in files _I have never touched_. In fact they are in a completely different series of directories to the one I am working on and someone else project entirely. How am I meant to know how to fix these? I dont know what the other developer wanted to do and if they have done it right.

I thought git only merged/pushed the files you have changed? If someone else has changed Group A files on the remote repo, why must I change my local Group A files when I am _pushing _completely different set of Group B files?

Sure, Id understand if I were pulling files down to my local and had to resolve merge conflicts then, but this isn't happening when I push the files up.

Any help or advice is much appreciated. Sorry if I sound frustrated - I am really trying hard to get my head round this whole git thing but its just so weird.

+1 vote

I wanted to avoid push if any of the files is deleted from the local git clone area. Can anyone please help me with that?

I am using Stash for repository management.

0 votes

If I create a git repo for multiple projects, for example ALL projects that my team works on, when they clone and pull, do they have to download all the files? Can they sort of selectively download the files they may want to read or work on?
The idea is I want to track a bunch of projects for my team ... so i was thinking to make a repo that contains something like this:

./MyTEAM/./MyTEAM/Project_A/
./MyTEAM/Project_A/Some_Files/
./MyTEAM/Project_A/Some_More_Files/
./MyTEAM/Project_B/
./MyTEAM/Project_C/

Then the entire team can contribute to any of the projects they may be working on, but they should not have to download every single file when they clone .. is that possible?
Basically I do not want to have to create a repo for every single project .. is that what people normally do?

0 votes

I have tried some methods introduced in the network, but always failed. Some big files committed by me to a very old branch then the files deleted and new branches were continuously created. Now the checkout directory has grown to about 80 megabytes.

What's the right way to permanently erase those garbage big files?


Useful Links with Similar Problem
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#470/147, 3rd Floor, 5th Main,
HSR Layout Sector 7,
Bangalore - 560102,
Karnataka INDIA.
QUERY HOME
...