Help us understand the problem. What is going on with this article?

git pull を --set-upstream-to で引数無しで実行可能にする

More than 5 years have passed since last update.

--set-upstream-to を使う

git pull は基本は引数が必要

$ git pull
There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details

    git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

    git branch --set-upstream-to=origin/<branch> branch_name

デフォルト参照先を決めるのには、各ローカルブランチごとに --set-upstream-to を使う

$ git branch --set-upstream-to=origin/master master
$ git branch --set-upstream-to=origin/develop develop
$ git branch --set-upstream-to=origin/gh-pages gh-pages

設定の一覧を見るには git branch -vv


$ git branch -vv
* develop  6834af6 [origin/develop] Commit message..
  gh-pages aec8d8f [origin/gh-pages] Commit message..
  master   ac4f990 [origin/master] Commit message..

こんな -vv ダブルピースなオプションあったんですね..

git push -u origin branch_name でお手軽登録


$ git push -u origin master
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away