Before we do anything, we need to assess the situation. Assuming you have checked out the branch that we're going to modify, we need to see the history.
Use git log
to deteremine how many commits to move.
git log
You'll see output similar to this:
commit 5576dbf62182ac1d263e9777e31ff7f35ac6eee3 (HEAD -> master)
Author: Tyler <tyler@email.com>
Date: Fri Nov 8 12:04:42 2019 -0800
Another commit to move
commit edec499e8c85adf8c6fd79bc1b6993bfb233a5a0
Author: Tyler <tyler@email.com>
Date: Fri Nov 8 12:04:29 2019 -0800
One commit to move
commit 896cfcd0ae55d95fa81915a60460948b40fa55fa (origin/master, origin/HEAD)
Author: Zach Levine <zach@email.com>
Date: Thu Nov 7 10:40:13 2019 -0500
Awesome code added to the repository.
We can see that that HEAD
is two commits ahead of origin/HEAD
, and these are the two commits we want to move to another branch.
In the remaining steps, we'll cover to how move these commits to a new branch or an existing branch.