Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Clone the repo: `git clone git@github.com:username/repo.git`
- By default, you only have the master branch locally:
- ```
- ~/repo$ git branch
- * master
- ```
- Fetch the target branch: `git fetch origin branch-name`
- Check it out: `git checkout origin/branch-name` (note the slash)
- Git will tell you that you're in a `detached HEAD` state. That's okay.
- Now create a new local branch with the same name: `git checkout -b branch-name`
- Tell Git to follow the changes of the remote branch: `git branch -u origin/branch-name`
- And you're done.
- ```
- ~/repo$ git branch
- master
- * other-branch
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement