Git設定一覧
$ git config -l
ブランチ一覧
$ git branch
直前のコミットを取り消す
$ git reset --soft HEAD^
Windowsで使う場合は"HEAD^"
特定ファイルのみ元に戻す
$ git checkout [コミット番号] [ファイルパス]
変更したファイルの差分一覧
$ git diff --name-only <コミットID1> <コミットID2>
特定のファイルの差分
$ git diff <コミットID1> <コミットID2> <ファイル名>
リモートのdevelopブランチをローカルのmainブランチにpull
$ git pull origin develop:main
ローカルのdevelopブランチをリモートのmasterブランチにpush
$ git push origin develop:master
特定のファイルを元に戻す
$ git checkout <filename>
リモートoriginを変更
$ git remote rm origin
$ git remote add origin https://github.com/bar/hogehoge.git
config変更
$ git config --global user.name hogehoge
$ git config --global user.email example@hogehoge.com
gitignoreに反映されない場合
$ git rm -r --cached <ファイル名>
$ git ls-files --other --ignored --exclude-standard
無視しているファイルの一覧
- origin: デフォルトのリポジトリの場所(URL)の別名
- main: デフォルトのブランチの名前。メインのブランチ