Skip to content

Commit

Permalink
spelling mistake corrected
Browse files Browse the repository at this point in the history
  • Loading branch information
mfktechm committed Aug 8, 2018
1 parent 96d47ab commit 616c877
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Moving a commit to a different branch
What if you commit a change, and then realize that you commited to a different branch?
What if you commit a change, and then realize that you committed to a different branch?
How can you change that? This is what this tutorial covers.

## Moving the lastest commits to an existing branch
Expand All @@ -8,8 +8,8 @@ To do this, type:
```git reset HEAD~ --soft``` - Undoes the last commit, but leave the changes available.
```git stash``` - Records the state of the directory.

```git checkout name-of-the-correct-branch``` - Swiches to another branch.
```git stash pop``` - Removes lastest stashed state.
```git checkout name-of-the-correct-branch``` - Switches to another branch.
```git stash pop``` - Removes latest stashed state.
```git add .``` - Or try adding individual files.
```git commit -m "your message here"``` - Saves and Commits the changes.

Expand All @@ -19,7 +19,7 @@ Now your changes are on the correct branch
### Moving the lastest commits to a new Branch
To do this, type:
```git branch newbranch``` - Creates a new Branch. Saving all the Commits.
```git reset --hard HEAD~#``` - Move master back by # commits. Remember, this commits will be gone from master
```git reset --hard HEAD~#``` - Move master back by # commits. Remember, these commits will be gone from master
```git checkout newbranch``` - Goes to the branch you created. It will have all the commits.

Remember: Any changes not commited will be LOST.
Remember: Any changes not committed will be LOST.

0 comments on commit 616c877

Please sign in to comment.