version control - Easy way to switch/swap git checkins between 2 branches -
i made implementation feature on develop-branch. worked out came interesting alternative. branched checkin of develop-branch before feature checkin on develop implement alternative.
decided alternative better implementation. wouldn't want loose first implementation. branches this:
i continue on "develop"-branch , keep 1st implementation on "newoverview" branch.
there easier way somehow preserve changes of each branch. undo both branch commits. reapply changes correct branch , checkin again? sounds lot of error prone tasks.
can tell git take 1st commit , put on "newoverview" branch , 2nd commit put on "develop" branch?
ann: repository has master branch. 1 changes merged when finished , develop branch. other branches not pushed server. locally.
checkout develop branch
git checkout develop
create new branch on top of develop save results. don't checkout!
git branch alternative
reduce develop common ancestor newoverview, seems previous commit.
if it's not previous commit, use last common ancestor's sha instead of head^
git reset --hard head^ git reset --hard abcd1234
merge new feature develop.
git merge newoverview
if ever goes wrong, use restore lost commits' shas
git reflog
Comments
Post a Comment