mirror of
https://github.com/k88hudson/git-flight-rules.git
synced 2025-03-10 12:48:43 -03:00
add checkout to remote branch
This commit is contained in:
parent
2a86ef478e
commit
485bcf6691
21
README.md
21
README.md
@ -47,6 +47,7 @@ For clarity's sake all examples in this document use a customized bash prompt in
|
|||||||
- [I want to delete local branches that were deleted upstream](#i-want-to-delete-local-branches-that-were-deleted-upstream)
|
- [I want to delete local branches that were deleted upstream](#i-want-to-delete-local-branches-that-were-deleted-upstream)
|
||||||
- [I accidentally deleted my branch](#i-accidentally-deleted-my-branch)
|
- [I accidentally deleted my branch](#i-accidentally-deleted-my-branch)
|
||||||
- [I want to delete a branch](#i-want-to-delete-a-branch)
|
- [I want to delete a branch](#i-want-to-delete-a-branch)
|
||||||
|
- [I want to checkout to a remote branch that someone else is working on](#i-want-to-checkout-to-a-remote-branch-that-someone-else-is-working-on)
|
||||||
- [Rebasing and Merging](#rebasing-and-merging)
|
- [Rebasing and Merging](#rebasing-and-merging)
|
||||||
- [I want to undo rebase/merge](#undo-rebase)
|
- [I want to undo rebase/merge](#undo-rebase)
|
||||||
- [I rebased, but I don't want to force push.](#i-rebased-but-i-dont-want-to-force-push)
|
- [I rebased, but I don't want to force push.](#i-rebased-but-i-dont-want-to-force-push)
|
||||||
@ -600,6 +601,26 @@ To delete a local branch:
|
|||||||
(master)$ git branch -D my-branch
|
(master)$ git branch -D my-branch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<a name="i-want-to-checkout-to-a-remote-branch-that-someone-else-is-working-on"></a>
|
||||||
|
### I want to checkout to a remote branch that someone else is working on
|
||||||
|
|
||||||
|
First, fetch all branches from remote:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
(master)$ git fetch --all
|
||||||
|
```
|
||||||
|
|
||||||
|
Say you want to checkout to `daves` from the remote.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
(master)$ git checkout --track origin/daves
|
||||||
|
Branch daves set up to track remote branch daves from origin.
|
||||||
|
Switched to a new branch 'daves'
|
||||||
|
```
|
||||||
|
|
||||||
|
(`--track` is shorthand for `git checkout -b [branch] [remotename]/[branch]`)
|
||||||
|
|
||||||
|
This will give you a local copy of the branch `daves`, and any update that has been pushed will also show up remotely.
|
||||||
|
|
||||||
## Rebasing and Merging
|
## Rebasing and Merging
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user