Background
I'm working with just one branch - master.
3---------2---------
|
6-------5---------4---------1----------
I made commits 1-3, then realised I wanted to work from commit 1 for the next section of work. I checked out commit 1, then made commits 4-6. Ooops. Commit 3 contains some important information I need.
The Problem
When I do a git log or view All Branches in GitX, all I see is this:
6-------5---------4---------1----------
How can I merge bits of commits 3 back to commit 6? (Is this called HEAD?)
Have I lost commits 2 and 3?
I know it was my fault for not making a new branch, but does that mean those commits are lost?
I'm still a Git newbie (despite using it for about 6 months) and still find it really confusing, so please be gentle!
You have not lost the commits. They are available in the reflog.
Run git reflog
and find the commits.
If you want the result to look like 6-5-4-3-2-1
, checkout 6
and rebase it on 3
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With