Reputation: 6161
current
branch and did commit good
. irrelevant
. good
(detached HEAD now). one
, in detached HEAD state.I would like to have some help to put one
just after good
, in current
branch.
It doesn't matter if I lost irrelevant
.
Upvotes: 0
Views: 319
Reputation: 60255
- I went back, checked out
good
(detachedHEAD
now).- I did commit
one
, in detachedHEAD
state.I would like to have some help to put one just after good.
one
is after good
. git commit
updates HEAD
, every time, no matter what. When you check out a branch tip, git sets the HEAD
reference as an alias for that branch tip reference, it "attaches" it to that branch tip reference. A detached HEAD
is just a reference directly to a particular commit, so when git commit
updates it, HEAD
now refers to the new one. But git commit
always adds the old HEAD
commit as the parent of the new one.
So just
git checkout -B current one # if you don't still have `one` checked out
or just
git checkout -B current # if you do
Upvotes: 2