2

I have made a bare repository (MY_LOCAL_REP) out of a public git repository hosted in github:

~$ git clone --bare <github repository location> 

The github repository had been updated (a branch was created) and I want to fetch the changes to MY_LOCAL_REP, so I ran

~$ git fetch 

The command completes successfully, but when I run

~$ git branch 

I don't see the new branch. What am I doing wrong? what is the correct way to 'pull' from a github repository into a bare repository?

Thanks!

2 Answers 2

4

Use git clone --mirror instead of git clone --bare if you want a bare repository that looks exactly like the remote repository.

See the git-clone manpage for more info.

Sign up to request clarification or add additional context in comments.

Comments

2

When you do a git fetch, it will fetch all of the remote branches, but won't create any new local branches. If you do a git branch -a, you should see the new branch - it will be named something along the lines of remotes/origin/branchname

To create a local version of the branch, you can just do git branch <branchname> origin/<branchname> - this will create a new local branch that tracks the remote branch.

This assumes that you already have a remote set up named origin. See git branch and git remote for more info about these commands.

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.