在git repo中找到文件

时间:2011-06-30 14:13:07

标签: git search

  

可能重复:
  How can I search Git branches for a file or directory?

在我的本地git仓库的某个地方,应该有一个名称中包含PDFCMap的文件。我怎样才能找到这个文件?我不知道它在哪个分支/路径。

[编辑] 请注意,副本中的答案对我不起作用。

1 个答案:

答案 0 :(得分:3)

git rev-list --objects --all --no-walk | grep -i PDFCMap

要遍历所有历史记录,请删除--no-walk选项(并通过sort -u管道传输:))

要查找文件的位置(分支):

git log --oneline  --all --no-walk --decorate -- full/path/you/obtained

e.g:

git log --oneline  --all --no-walk --decorate -- full/path/you/obtained src/SConstruct
1fb30cf (zfs-fuse.net/testing, rudd-o/testing) fix missing split on environment CFLAG reported on gentoo by Marcin Miroslaw
fc48fe2 (sehe.nl/marcin) Takes CC en CFLAGS from the environment for scons
9bfb958 (sehe.nl/ctl) Merge branch 'ctldir' of http://rainemu.swishparty.co.uk/git/zfs into ctl
1ef5d94 (MikeHommey/build/no-ztest) Don't build nor install ztest
c5ed979 (MikeHommey/build/clean) Cleanup after scons
d6164c4 (MikeHommey/build/optim) Add an optim option to the build system
673b82c (MikeHommey/upstream/tarball) 0.5.0 release tarball
f71cca1 (tag: 0.4.0_alpha1) Doc updates. Made install_dir a command-line parameter. Adjust ARC size so that zfs-fuse shouldn't go over 100 MB of RAM.
d653bf2 (tag: 0.2.2) Automatically create symbolic links when building.