Gitコマンド早見表一覧

Gitコマンド一覧

■ディレクトリ作成

$ mkdir sample

■移動

$ cd sample/

■Git環境初期化

$ git init

■ファイル追加

$ git add sample.txt

■コミット

$ git commit -m "write comment"

■ブランチを作成

$ git branch issue1

■ブランチ一覧

$ git branch
実行結果例
   issue1
 * master
頭に【*】がついているものが現在のブランチ

■ブランチの切り替え

$ git checkout issue1
checkoutコマンドに『-b』オプションを指定して実行すると、ブランチの作成とチェックアウトをまとめて行える。

■ブランチをマージ

$ git merge issue1
現在のブランチに『issue1』の内容を反映する

■ブランチを削除

$ git branch -d issue1

Comments are closed.