19
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

git aliasで複合コマンドを設定したい

Last updated at Posted at 2013-07-24

git-aliasでファイルにshellとして書くほどではないけど、gitのコマンドを複数実行したい場合はこんな感じで設定する事が可能です。

.gitconfig
[alias]
    checkoutclean = !sh -c "git checkout . && git clean -f -d"

コメントで@ngyukiさんから指摘を受けていますが、!sh -cとかしなくても以下で大丈夫でした。

.gitconfig
[alias]
    checkoutclean = !git checkout . && git clean -f -d

つまり、gitをshellとして実行して && で連結して実行する形になります。

以上です。

参考サイト

19
11
2

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
19
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?