简体   繁体   English

列出 git 存储库中未由 `git Annex add` 添加的所有文件

[英]List all files in git repo not added by `git annex add`

Is there a way to list all files I added via git add (ref 1) and not by git annex add (ref 2)?有没有办法列出我通过git add (参考 1)而不是通过git annex add (参考 2)添加的所有文件?

mkdir myrepo
cd myrepo
git init .
mkdir foo
dd if=/dev/random of=foo/bar.ext count=1024 bs=1024
git add foo   # <----- ref 1   
git commit -m "add foo"
git annex init "listing"
mkdir baz
dd if=/dev/random of=baz/abc.ext count=1024 bs=1024
dd if=/dev/random of=baz/efg.ext count=2024 bs=1024
dd if=/dev/random of=baz/xyz.ext count=512 bs=1024
git annex add baz    # <---- ref 2
git commit -m "add baz"

So when I run git <some command> it should show something like所以当我运行git <some command>它应该显示类似

foo/bar.ext

One of the solutions I used is https://stackoverflow.com/a/61680771/7274758 .我使用的解决方案之一是https://stackoverflow.com/a/61680771/7274758 But I am wondering if there is any better way?但我想知道是否有更好的方法?

  1. Use ls-files to list all files in repo.使用ls-files列出 repo 中的所有文件。
  2. Use annex find to list all files in annex.使用annex find列出附件中的所有文件。
  3. Find the unique entries from the above results从上述结果中查找唯一条目
git ls-files > ~/tmp/ls-files.list
git annex find > ~/tmp/annex-find.list
awk 'FNR==NR {a[$0]++; next} !a[$0]' ~/tmp/annex-find.list ~/tmp/ls-files.list

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM