LoginSignup
7
4

More than 1 year has passed since last update.

#git push でリモートブランチ名を指定なしで実行できるようにする ( $ git config --global push.default current )

Last updated at Posted at 2019-05-10

グローバル設定を変更する例

$ git config --global push.default current

~/.gitconfig

configファイルにこんなのが記述されます

[push]
	default = current

こういうエラーをなくしたい

fatal: The current branch chore/logdir has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin some
git config --global push.default current

ためになる記事

gitのpush.defaultに関するノウハウ - Qiita

simple
これからのデフォルト。upstreamが設定されていて、それが同名のブランチ名であるときのみpushする。初心者でも安心して使える。初心を忘れないあなたと、デフォルトを愛するあなた向き。

current
現在のブランチをリモートに同名でpushする。例えupstreamを設定していなくてもpushされるので、めんどくさがりで効率重視なあなた向き。

まとめ
結局どれ使えばいいかわからないという人は、次世代のデフォルトのsimpleか、currentを使うといいと思います。currentはかなり楽なので、僕はこれを使っています。

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

7
4
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
7
4