Reputation: 59
I created a branch on the github website that wasn't in my local repository. How do I bring that branch to my local computer, edit it, and then push it back to my github account?
Upvotes: 2
Views: 4084
Reputation: 1
You have to update your local files first. In your terminal:
Or
You can bring your codebase back to the exact commit of a branch you are talking about. In the repo under the specific branch you should see all of your commits. The number on the righthand side of each commit is the SHA number. You can copy this and then use the following:
git fetch origin SHA git checkout FETCH_HEAD
Upvotes: 0
Reputation: 22939
Run
git fetch
to retrieve the new branch from GitHub's server and then use
git checkout YOUR-BRANCH-NAME
to switch to that branch.
When you have committed your changes, push them to GitHub using
git push
See Git Branching - Remote Branches for more information.
Upvotes: 1
Reputation: 549
In your local workdir enter:
git fetch origin newbranch
git checkout newbranch
where newbranch
is the name of your new branch.
Then do your edits, and when finished do:
git push origin newbranch
Upvotes: 1