Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

configure git so that "git pull" instead of "git pull origin master"?

Tags:

git

Using git pull used to pull from the remote repository as expected - now, it's asking me to use git pull origin master. I don't quite understand the instructions it's giving me, saying I can add something to my configuration file:

[branch "master"] remote = <nickname> merge = <remote-ref>  [remote "<nickname>"] url = <url> fetch = <refspec> 

Right now my configuration file looks like

[core]     repositoryformatversion = 0     filemode = true     bare = false     logallrefupdates = true     ignorecase = true [remote "origin"]     url = |redacted|     fetch = +refs/heads/*:refs/remotes/origin/* 

So I'm guessing I need to add

[branch "master"]     remote = origin     merge = ?? 

What does "merge" need as its argument? What's a remote-ref(erence?)? I tried looking at http://git-scm.com/docs/git-config but it seems to be more about the command itself.

Thanks in advance!

like image 300
munchybunch Avatar asked Nov 28 '10 16:11

munchybunch


People also ask

Is git pull the same as git pull origin master?

Remember, a pull is a fetch and a merge. git pull origin master fetches commits from the master branch of the origin remote (into the local origin/master branch), and then it merges origin/master into the branch you currently have checked out.

Does git pull pull from master?

'git pull origin master' will fetch and update only a specific branch called master and origin in the remote repository. Often, the default branch in Git is a master branch, and it keeps updating frequently. A user can use any branch name to pull that branch from the remote.

How do I undo git pull origin master?

There is no command to explicitly undo the git pull command. The alternative is to use git reset, which reverts a repository back to a previous commit.

Does git pull default to master?

The behavior is default because it allows you to synchronize the whole repositories at once. If you don't want to update all local branches at once, use git fetch to synchronize the repositories and git merge origin/<branch> to update each single local branch.


2 Answers

try:

[branch "master"]     remote = origin     merge = refs/heads/master 
like image 66
Horia Dragomir Avatar answered Sep 22 '22 10:09

Horia Dragomir


It should be enough just to execute

git config branch.master.remote origin 
like image 31
svick Avatar answered Sep 24 '22 10:09

svick