0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cdをせずにgitコマンドを実行したい

Posted at

はじめに

スクリプトや CI、複数リポジトリを扱うバッチ処理などで、cd を使わずに git サブコマンドを実行したい場合は -C オプションを利用します。

概要

  • 構文: git -C <path> <subcommand> [args...]
  • git-C → サブコマンド の順に指定する必要があります。
  • -C は複数回指定できます。後の -C が優先され、作業ディレクトリが上書きされます。

C:\Path\To\MyRepositoryの履歴を取得する

git -C C:\Path\To\MyRepository log --oneline

環境

  • git version 2.43.0.windows.1
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?