LoginSignup
10
10

More than 5 years have passed since last update.

git ls-tree

Posted at

Gitにls-treeというサブコマンドがあったのを知ったのでメモ。

Terminal
$ git ls-tree -dr --name-only --full-name --full-tree HEAD

リポジトリ内の全ディレクトリが表示できる。っぽい。速い。

Terminal
$ git rev-parse --show-toplevel

でリポジトリのルートディレクトリの絶対パスが取得できるので、

.bashrc
peco-cd() {
  cd "$(git ls-tree -dr --name-only --full-name --full-tree HEAD | sed -e "s|^|`git rev-parse --show-toplevel`/|" | peco)"
}

とか書いて

Terminal
$ peco-cd

でやったーって感じになる。


ターミナルだけじゃなくてunite.vimでもdirectory_rec/asyncの代わりに使いたい感じだ( ˘ω˘)

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10