Open2

Git/GitHub TIPS

Hayashi NaokiHayashi Naoki

pull request を merge する前にCIを必須にする

デフォルトだと,CIが通ってなくても,merge できてしまう.
[設定]>[ルールセット] から,ルールを作成して,以下のように設定するとCIが通らないとマージできないようにできる.

Hayashi NaokiHayashi Naoki

git checkout の代わりに,git switch, git restore を使う

git 2.23(2019年8月 release) から,git checkout の代わりに これらのコマンドを使用することが推奨されている.

  • ブランチの移動: git checkout <branch>git switch <branch>
  • ブランチを作成して移動: git checkout -b <branch>git switch -c <branch>
  • ファイルの変更の取り消し: git checkout <file path>git restore <file path>

コマンドの意味が分かりやすくなってる 👀