I made changes to the wrong branch (#202)

* I made changes to the wrong branch

* Missed from last commit

* Fixing links

* Making changes

* Another change

* Moving section
This commit is contained in:
Nick Kirby 2018-01-07 15:46:31 +00:00 committed by Richard Littauer
parent be480c4c35
commit e0513d81c2
1 changed files with 11 additions and 0 deletions

View File

@ -61,6 +61,7 @@ For clarity's sake all examples in this document use a customized bash prompt in
- [I want to create a new remote branch from current local one](#i-want-to-create-a-new-remote-branch-from-current-local-one)
- [I want to set a remote branch as the upstream for a local branch](#i-want-to-set-a-remote-branch-as-the-upstream-for-a-local-branch)
- [I want to set my HEAD to track the default remote branch](#i-want-to-set-my-head-to-track-the-default-remote-branch)
- [I made changes on the wrong branch](#i-made-changes-on-the-wrong-branch)
- [Rebasing and Merging](#rebasing-and-merging)
- [I want to undo rebase/merge](#i-want-to-undo-rebasemerge)
- [I rebased, but I don't want to force push](#i-rebased-but-i-dont-want-to-force-push)
@ -839,6 +840,16 @@ $ git remote set-head origin --auto
origin/HEAD set to master
```
### I made changes on the wrong branch
You've made uncommitted changes and realise you're on the wrong branch. Stash changes and apply them to the branch you want:
```sh
(wrong_branch)$ git stash
(wrong_branch)$ git checkout <correct_branch>
(correct_branch)$ git stash apply
```
## Rebasing and Merging
<a name="undo-rebase"></a>