はじめに
昨日に引き続き、gitの基本的なコマンドを覚え書きのつもりで紹介します。
↓昨日の投稿
きっとgit使えないとbad
ローカルでブランチを切ってマージするまで
ローカルブランチを作成
% git branch ブランチ名
ローカルでブランチを切り替える
% git checkout ブランチ名
ローカルでブランチを作成し、切り替える(上2つを同時に行う感じ)
% git checkout -b ブランチ名
間違えてマスターにコミットしないためには、こっちの方が使い勝手がいいかな…
マスターに切り替える
% git checkout master
全て(ローカル・リモート)のブランチを一覧表示
% git branch -a
ローカルのブランチをリモートにプッシュ
% git push -u origin ローカルのブランチ名
ブランチをマージする
% git merge ブランチ名
その他使いそうなコマンド
ブランチの削除
% git branch -d ブランチ名
ブランチ名の変更
% git branch -m 古いブランチ名 新しいブランチ名
変更点の表示
% git diff
終わりに
-d
みたいにオプションが多い印象です。何かの頭文字として覚えられればいいのだが…