忘れがちなのでまとめておきます。
随時追加していく予定です。
// グローバル設定
$ git config —-global -l
// ローカル設定
$ git config —-local -l
グローバル設定
// 名前設定
$ git config —-global user.name your_name
// メールアドレス設定
$ git config —-global user.email your_email_address
ローカル設定
// 名前設定
$ git config —-local user.name your_name
// メールアドレス設定
$ git config —-local user.email your_email_address
Git 管理対象にする
$ git init
リモートリポジトリをクローンする
$ git clone https://github.com/your/repository
変更ファイルのステージング
// ファイルを個別にステージする
$ git add 変更したファイル
// カレントディレクトリ配下のファイルをすべてステージ
$ git add .
変更ファイルのコミット
$ git commit -m "コミットメッセージ"
リモートリポジトリへプッシュ
$ git push origin リモートブランチ
リモートリポジトリの変更点を取得
$ git pull origin リモートブランチ
ローカルの変更を一時退避
$ git stash
コメント付きで一時退避
$ git stash save "コメント"
現在のブランチの確認
$ git branch
ブランチの移動
$ git checkout 移動先のブランチ
ローカルブランチの作成
// 作成のみで移動しない
$ git branch 新しいブランチ
// 作成してそのブランチに移動
$ git checkout -b 新しいブランチ
ローカルブランチ名の変更
$ git branch -m 変更前のブランチ名 新しいブランチ名
// 今いるブランチのリネームなら、変更前のブランチ名は省略できる
$ git branch -m 新しいブランチ
ローカルブランチの削除
$ git branch -d 削除したいブランチ