git - How to back out from back out? -
i have backed out commit (commit#1), after realized needed commit.
have checked out commit#1. now, how can put version end of branch?
if haven't done other work, can reset current branch on commit.
git checkout yourbranch git reset --hard <sha1>
the op barnabas szabolcs advices in comments:
git reset --soft @^
(with recent git, @ alias head)
that allow keep working tree , index (of checked out old commit) intact, while resetting head previous commit in order make new 1 (with content of checked out commit).
if have done other commits, need cherry-pick commit current branch:
git checkout yourbranch git cherry-pick <sha1>
in case, checkout of old commit dangerous, leads detached head situation (except when followed git reset ---soft head^
).
Comments
Post a Comment