Open9
覚えなきゃと思った Git のコマンド

git branch
: ブランチの一覧を表示

複数の Github アカウントを使いたいとき、そのリポジトリでどのアカウントを使うのか設定する
git config --local user.name <user_name>
git config --local user.email <user_name>@users.noreply.github.com
git config --local --list

git remote set-url origin {new url}
: remote の url を変更する

初回 push 前には upstream branch を設定する必要がある
git push --set-upstream origin <ブランチ名>

直前の add 取り消し
git reset HEAD
ブランチ間違えて超焦った

ローカルブランチの削除
git branch -d [ブランチ名]

直前のコミットまで戻す
git reset --hard HEAD

ブランチ名の変更方法
$ git branch -m 古いブランチ名 新しいブランチ名
// 今いるブランチの名前を変更する場合
$ git branch -m 新しいブランチ名

コミットメッセージの変更
git commit --amend -m "変更したいメッセージ"
わざわざコミットを消さなくてもいいのね…知らなかったわ