Questions tagged [git-ls-files]

36 questions
363
votes
9 answers

Git: list only "untracked" files (also, custom commands)

Is there a way to use a command like git ls-files to show only untracked files? The reason I'm asking is because I use the following command to process all deleted files: git ls-files -d | xargs git rm I'd like something similar for untracked…
We Are All Monica
  • 11,597
  • 7
  • 41
  • 69
41
votes
1 answer

git ls-files in bare repository

I want to access a bare git repository, and I want to list all files in the repository. On a normal git repository I can easily do that by running git ls-files. Example output: $ git…
Jesper Rønn-Jensen
  • 91,561
  • 40
  • 112
  • 147
10
votes
2 answers

git ls-files, how to escape spaces in files paths?

A whole BUNCH of files got checked into our git repo before we introduced the .gitignore file. I'm currently trying to clean it up with: git rm --cached `git ls-files -i --exclude-from=.gitignore` The thing is MANY of the file paths have spaces…
Sean Novak
  • 468
  • 2
  • 13
7
votes
1 answer

Is comparing git lfs ls-files with git ls-files ':(attr:filter=lfs)' a reliable way to detect lfs files that are not managed by lfs?

I try to find a way to determine whether the files in git repository are correctly managed by git-lfs. So far, I have found that comparing results from git lfs ls-files and git ls-files ':(attr:filter=lfs)' seems to give me what I want. Add-Type…
Eugene Podskal
  • 9,882
  • 5
  • 29
  • 51
5
votes
1 answer

List last edits of all file by a collection of users

Question: Given a git repo, show the files modified by a specific set of users, plus the last editor (from that set of users) of those files. Potential solution: git ls-files | xargs -n 1 git log -1 --author="example.com" --name-only…
stephenfin
  • 1,340
  • 2
  • 17
  • 37
3
votes
2 answers

Possible to read file from git cache?

I can see list of files using below command git ls-files --cache Wondering if it's possible to read the content of the listed file?
Isaac
  • 8,290
  • 6
  • 32
  • 69
3
votes
1 answer

git fails to stage files, show all files as duplicate but the char casing is not an issue

I have read every single post on here about similar issues but none of them are same as mine. In my case, I did simple one liner change to one of my file and wanted to commit my changes but noticed that commit -am "" did not add/commited the…
pixel
  • 6,765
  • 12
  • 60
  • 101
3
votes
1 answer

Git ls-files behaviour

It's not clear how git ls-files using wildcards actually functions. I started with the git ls-files *.* command which works okay. It shows all the files under version control in all the underlying subdirectories But now I want to select a set of…
3
votes
1 answer

What is the meaning of the different fields in the output of `git ls-files -s`?

In Git, a typical line of the result returned by command git ls-files -s looks like 100755 be2c2e9b0966253096472d4b482c458bc892e493 0 .gitignore What do those fields mean?
qazwsx
  • 21,470
  • 25
  • 65
  • 97
2
votes
2 answers

How to compare local and remote git files?

I need to list all tracked commited files that only exist locally. Let's say my local repo is a commit forward the remote repo (on github or gitlab) and these are my local tracked commited files: a.txt b.txt Now imagine in my remote repo there is…
Fernando Costa
  • 619
  • 8
  • 25
2
votes
1 answer

Git - List files recursively by branch/tag name

I want to see file trees without cloning all remote files. Is it possible using git commands? git version 2.21.0 My current commands are below: - mkdir my-repo && cd my-repo - git init - git remote add origin https://remote-repo-url - git fetch -…
zakjma
  • 1,740
  • 11
  • 34
  • 65
2
votes
1 answer

How an I make `git ls-files` work in subdirectories?

I want to run git ls-file --modified to obtain a list of files with unstaged changes. I was surprised to find that it works in the root directory, but not in any subdirectory, where it only prints files from the subdirectory (in contrast to git…
oarfish
  • 3,240
  • 4
  • 25
  • 54
2
votes
1 answer

Rugged equivalent to 'git ls-tree'

In a bare repository I can type $ git ls-tree -r master. (this is sort of the same thing I can get in a none-bare repos with the command git ls-files ) for a full list of files and their sha refs in a git repository. With Rugged, how do I get that…
Jesper Rønn-Jensen
  • 91,561
  • 40
  • 112
  • 147
1
vote
1 answer

Difference between --others and --other in git-ls-files

I want to understand the difference between --others and --other in git-ls-files . I got same result when i use 'git-ls-files --others --ignored --exclude-standard' and 'git-ls-files --other -ignored --exclude-standard'.
lucku
  • 11
  • 1
1
vote
2 answers

git ls-files - undocumented syntax that queries files based on their .gitattributes - git ls-files ':(attr:filter=lfs)'

Is comparing git lfs ls-files with git ls-files ':(attr:filter=lfs)' a reliable way to detect lfs files that are not managed by lfs? uses git ls-files syntax that queries files based on their .gitattributes (in that particular case on…
Eugene Podskal
  • 9,882
  • 5
  • 29
  • 51
1
2 3