0
0

More than 3 years have passed since last update.

きっとgit使えないとbad②

Posted at

はじめに

昨日に引き続き、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みたいにオプションが多い印象です。何かの頭文字として覚えられればいいのだが…

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