LoginSignup
3
1

More than 1 year has passed since last update.

Git リモートリポジトリにpushするときにブランチ名を省略する方法

Last updated at Posted at 2022-06-26

めんどくさい方法

$ git push origin topic-xxx

ブランチ名指定するのがめんどくさい!

$ git push origin HEAD

HEAD指定するとローカルブランチを同じ名前のリモートブランチを作成してくれます。

$ git push -u origin HEAD

-u オプションを付けると次回以降は git push だけで良くなります。

まぁ、めんどくさい。

快適な方法

$ git config --global push.default current

上を予め設定しておくと

$ git push

だけでローカルブランチと同じ名前のリモートブランチを作成してくれます。

参考

3
1
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
3
1