version control - Git revert back to previous commit and keep committing new changes to master -
i'm on branch master, head pointing last commit on master , i'm wondering if following possible:
- revert previous commit b.
- move commits b (b excluded) new branch "experimental". after master's last commit should b , "experimental"'s last commit should a.
- make new commit c after b under branch master. after master's last commit should c
all commits pushed origin, , working directory clean (no staged or unstaged changes).
any guidance appreciated.
git checkout -b experimental // create , switch branch "experimental" existing changes master. git push origin experimental // push "experimental" remote origin. git checkout master // switch branch "master" git reset --hard <commit> // bring head <commit> mentioned. also, remove uncommitted changes "master" git add <files> // add files committed "master" git commit -m "new commit c" // can new commit "c" master current branch. git push origin master // push master remote
hope solves issue.
Comments
Post a Comment