在Git中,如何通過多個分支中的路徑搜索文件或目錄?我已經(jīng)在分支中寫了一些東西,但我不記得是哪個?,F(xiàn)在我需要找到它。澄清:我正在尋找我在其中一個分支上創(chuàng)建的文件。我想通過路徑而不是內(nèi)容來查找它,因?yàn)槲也挥浀脙?nèi)容是什么。
3 回答

慕碼人8056858
TA貢獻(xiàn)1803條經(jīng)驗(yàn) 獲得超6個贊
git log+ git branch會為您找到:
% git log --all -- somefile
commit 55d2069a092e07c56a6b4d321509ba7620664c63
Author: Dustin Sallings <dustin@spy.net>
Date: Tue Dec 16 14:16:22 2008 -0800
added somefile
% git branch -a --contains 55d2069
otherbranch
也支持滾動:
% git log --all -- '**/my_file.png'
單引號是必需的(至少在使用Bash shell的情況下),因此shell將glob模式傳遞給git而不更改git,而不是擴(kuò)展它(就像Unix一樣find)。
- 3 回答
- 0 關(guān)注
- 2098 瀏覽
添加回答
舉報
0/150
提交
取消