Default remote for git fetch

后端 未结 4 2095
闹比i
闹比i 2021-02-07 07:22

If I am on a local branch that is not tracking any remote branch and I give the command

git fetch

Given I have several remotes defined

4条回答
  •  被撕碎了的回忆
    2021-02-07 07:48

    In your project folder, when you initialize git in the first step, .git folder is created.

    Look into this folder for a file named config, it contains all the branch info. origin is used as the default.

      [remote "origin"]
          fetch = +refs/heads/*:refs/remotes/origin/*
          url = git@github.com:project.git
    

    So the code is fetched from the url listed here.

提交回复
热议问题