2

I'm trying to rebase my feature branch to the master branch. But, when I try to pull or fetch using git, it's not even pulling the master branch from the remote to the local.

Here are the steps which I tried

$ git merge origin/master merge: origin/master - not something we can merge $ git merge master merge: master - not something we can merge $ git branch -r origin/feature git branch -a * feature remotes/origin/feature $ git fetch --all Fetching origin $ git pull --all Fetching origin Already up to date. 

I cloned in the following way

git clone https://github.optum.com/<Repo details> --branch feature --single-branch 
3
  • 1
    It looks like you don't have a master branch. What is the output of git branch with no options, or git branch -a? Along similar lines: what is the output of git config --get-all remote.origin.fetch? How did you make the clone? Commented Nov 22, 2019 at 9:10
  • @torek, updated in the question. Please check Commented Nov 22, 2019 at 9:13
  • 1
    Clone without using --single-branch Commented Nov 22, 2019 at 9:17

2 Answers 2

3

This is caused by the fact you cloned with --single-branch, this changer the repos configuration to scope all commands to that specific branch for the remote. You can undo the command or add another branch as explained here.

git remote set-branches --add origin [remote-branch] git fetch origin [remote-branch]:[local-branch] 
Sign up to request clarification or add additional context in comments.

Comments

2

From git help clone for the --single-branch option:

Clone only the history leading to the tip of a single branch, either specified by the --branch option or primary branch remote’s HEAD points at. Further fetches into the resulting repository will only the remote-tracking branch for the branch this option was used for the initial cloning. If the at the remote did not point at any branch when --single-branch clone was made, no remote-tracking is created.

This would suggest your clone has only cloned the history of the feature branch, hence why your local repository has no idea that a master (or any other branches) exist on the remote.

As I was typing this, @jessehouwing answered with instructions how to fix this

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.