mirror of
https://github.com/k88hudson/git-flight-rules.git
synced 2025-03-10 12:48:43 -03:00
Use branch
instead of checkout -b
Using `checkout -b` to create a new branch only to immediately checkout the previous branch is kind of pointless.
This commit is contained in:
parent
9536d6987d
commit
951e37cc2e
12
README.md
12
README.md
@ -192,12 +192,10 @@ Since rebasing **replaces the old commit(s) with a new one**, you must force pus
|
|||||||
## I committed to master instead of a new branch
|
## I committed to master instead of a new branch
|
||||||
|
|
||||||
|
|
||||||
Check out a new branch, then return to your master branch
|
Create the new branch while remaining on master:
|
||||||
|
|
||||||
```
|
```
|
||||||
(master)$ git checkout -b new-branch
|
(master)$ git branch new-branch
|
||||||
(new-branch)$ git checkout master
|
|
||||||
(master)$
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Find out what the commit hash you want to set your master branch to (`git log` should do the trick). Then reset to that hash.
|
Find out what the commit hash you want to set your master branch to (`git log` should do the trick). Then reset to that hash.
|
||||||
@ -209,6 +207,12 @@ For example, if the hash of the commit that your master branch is supposed to be
|
|||||||
HEAD is now at a13b85e
|
HEAD is now at a13b85e
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Checkout the new branch to continue working:
|
||||||
|
|
||||||
|
```
|
||||||
|
(master)$ git checkout new-branch
|
||||||
|
```
|
||||||
|
|
||||||
<a name="cherry-pick"></a>
|
<a name="cherry-pick"></a>
|
||||||
## I made several commits on a single branch that should be on different branches
|
## I made several commits on a single branch that should be on different branches
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user