有辦法在一個(gè)命令中獲取git根目錄嗎?Mercurial可以通過(guò)以下方式打印根目錄(包含.hg)hg root在git中是否有類(lèi)似的內(nèi)容來(lái)獲取包含.git目錄的目錄?
3 回答

揚(yáng)帆大魚(yú)
TA貢獻(xiàn)1799條經(jīng)驗(yàn) 獲得超9個(gè)贊
man
git-config
如果別名展開(kāi)以感嘆號(hào)作為前綴,則它將被視為shell命令。[.]注意,shell命令將從存儲(chǔ)庫(kù)的頂層目錄執(zhí)行,該目錄可能不一定是當(dāng)前目錄。
git config --global --add alias.root '!pwd'

慕娘9325324
TA貢獻(xiàn)1783條經(jīng)驗(yàn) 獲得超4個(gè)贊
git rev-parse --git-dir
" ?
F:\prog\git\test\copyMerge\dirWithConflicts>git rev-parse --git-dir F:/prog/git/test/copyMerge/.git
--git-dir
--git-dir Show $GIT_DIR if defined else show the path to the .git directory.
git setup-sh
git rev-parse --show-superproject-working-tree
- 3 回答
- 0 關(guān)注
- 480 瀏覽
添加回答
舉報(bào)
0/150
提交
取消