LoginSignup
0
0

More than 3 years have passed since last update.

リモートブランチをローカルにチェックアウトしたい

Posted at
git checkout -b LOCAL_BRANCH_NAME origin/REMOTE_BRANCH_NAME

でチェックアウトできます。
LOCAL_BRANCH_NAMEとREMOTE_BRANCH_NAMEを変えればローカルとリモートでブランチ名が変えられます。
自分は基本リモートブランチとローカルブランチの名前を変えたいことがないので、

$ git config --global --edit
[alias]
        new = !sh -c 'git checkout -b $0 origin/$0'

とエイリアスに登録しています。
これで登録していると、以下でリモートブランチをローカルにチェックアウトできます。

$ git new REMOTE_BRANCH_NAME
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