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

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

動(dòng)漫人物
TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超10個(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)注
- 3399 瀏覽
添加回答
舉報(bào)
0/150
提交
取消