revert - Git: Reset to old commit -
i know question has been answered couple of times, far, every posted solution tried did not work me :(
the situation is: have working commit in master branch want go to. unfortunately, multiple changes (including merges other branches) have been pushed master since then.
so need master branch last working commit again - or checkout last working commit , "overwrite" last commits on master - on server (github) repo. don't care if changes made last working commit lost, wouldnt hurt if kept intact.
important other branches not touched!!!
git revert did not job in multiple ways...
we can try replacing master branch new branch, fishy :)
create new branch working commit know
if commit nth level down head use
git branch master-temp head~n
. replace n level.- if have commit hash use
git branch master-temp <sha1>
- if have commit hash use
- rename current master branch new name
master-old
ormaster-deprecated
- rename new branch
master-temp
master
this remain changes, create branch of working code. team members can continue work without changes.
if other commit required old branch, cherry-pick commit new master branch.
as @flows added,
- need use
git push -force <branch>
if need push master.
local master branch has updated changes , dev cycle follows designed.
Comments
Post a Comment