git:获取文件的绝对路径,相对于回购 [英] git: Get absolute path of file, relative to repo
本文介绍了git:获取文件的绝对路径,相对于回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$ b
$ cd lib $ 如何获得文件的绝对(完整)路径,相对于repo? b $ b $ git绝对路径test.c#如何做到这一点?
lib / test.c
解决方案
code> git ls-tree :
$ cd lib
$ git ls-tree --full-name --name-only HEAD test.c
lib / test.c
这仅适用于已被提交到回购协议中的文件,但总比没有好。
How do I get the absolute (full) path of a file, relative to the repo?
$ cd lib
$ git absolute-path test.c # how to do this?
lib/test.c
解决方案
Use git ls-tree
:
$ cd lib
$ git ls-tree --full-name --name-only HEAD test.c
lib/test.c
This only works for files that have been committed into the repo, but it's better than nothing.
这篇关于git:获取文件的绝对路径,相对于回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文