What is the difference between the following git config

.git / config 1

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = ssh://johndoe@example.com//repositories/plugins/myproject.git
[branch "master"]
    remote = origin
    merge = refs/heads/master

      

.git / config 2

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
[remote "origin"]
    fetch = +refs/heads/*:refs/remotes/origin/*
    url = ssh://johndoe@example.com//repositories/plugins/myproject.git
[branch "master"]
    remote = origin
    merge = refs/heads/master
[branch "develop"]
    remote = origin
    merge = refs/heads/develop]

      

However, in both repos, when I typed branch -a

, both return

git branch -a
* develop
  master
  remotes/origin/HEAD -> origin/master
  remotes/origin/develop
  remotes/origin/master

      

+3


source to share


2 answers


If you try to checkout from a development branch a repo that does not define [branch "develop"]

with git pull

, you will get an error stating that you did not specify a remote branch. Git will prompt you to run git branch --set-upstream develop origin/develop

to create this entry and track the remote branch correctly.



+3


source


You don't have a branch develop

tracking a branch in the remote repository in the first.



To see the difference, run git branch -avv

in each repository. This will show all branches (local and remote), which commits will be enabled and which remote branches (if any) will be tracked by each local branch.

+3


source







All Articles