Home » Questions » Computers [ Ask a new question ]

How to get "git pull" to work as expected again

How to get "git pull" to work as expected again

I'm using msysgit (Git for Windows). It used to be that running "git pull" would automatically "git fetch", and then rebase my changes on every branch with the new HEAD from upstream. Now it seems "git pull" usually just gives me errors about how I have no "branch.*.merge" set in my configuration file. When this worked before, I hadn't done anything special in my config file. Is it how I create my local branches? I usually do this:

Asked by: Guest | Views: 194
Total answers/comments: 1
bert [Entry]

"You need something similar to the following in your config file:

[branch ""master""]
remote = origin
merge = refs/heads/master

If you need to add this information for an existing branch, you can use the command:

git branch --set-upstream mybranch origin/remotebranch

If you're creating a new branch, you can ensure the branch is a remote tracking branch by using one of the commands:

git branch --track mybranch origin/remotebranch
git checkout --track -b mybranch origin/remotebranch

However, --track should be the default. If it isn't, then the setting branch.autosetupmerge might be set to false. To reset it, you can set it to true or unset it:

git config --global branch.autosetupmerge true
git config --global --unset branch.autosetupmerge"