So I've created a quick change on the GitHub repo, but it requires more work, adding unit tests, and running the build. So I have new branch created with web interface:
https://github.com/jcubic/prism/tree/patch-1
But when I use git pull
, in the terminal, I have nothing was changed. When I use git branch -a
I've got:
$ git branch -a
* master
scheme-operators
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/upstream/gh-pages
remotes/upstream/maste
no branch patch-1
. I have this in .git/config:
[remote "origin"]
url = [email protected]:jcubic/prism.git
fetch = refs/heads/master:refs/remotes/origin/master
How I can update my local repo with stuff that is on GitHub?
CodePudding user response:
You need to fetch the branches from the remote first.
- To fetch all remote branches run
git fetch --all
- Then to view all the branches run
git branch -a
- Then to checkout the branch run
git checkout nameofnewbranch
CodePudding user response:
You need to use git fetch
first.
This downloads all branches and their commit histories from GitHub (note that git pull
also runs git fetch
but also a git merge
).
After running git fetch
, you can see the remote branch with git branch -a
.
Then, you can check it out using git checkout patch-1
or git checkout -b patch-1 remotes/origin/patch-1
.