git - Moving merged commits back to old branch, reverting master and keeping changes -


i merged commits master, need changes on new branch , master reverted what pre-merge.

here's commit history looks now:

and here's like:

i'm not seeing differences, believe understand problem, it's i've done before.

1) create new branch: assuming master current branch, create new branch

c:\git\project> git branch my_new_branch 

2) reset master branch. let's assume last 4 commits need out.

c:\git\project> git reset --hard head~4

3) work on new branch

c:\git\project> git checkout my_new_branch

the --hard causes indexes reset of first commit want keep, , modifications lost.

a few caveats: -if you've pushed master changes remote, doesn't affect remote. @ least @ site, can't push reset, have work remote's owner (or git admin) similar this. -the --hard should clean untracked files, @ least docs read so, i'm not convinced occurs.


Comments

Popular posts from this blog

c++ - No viable overloaded operator for references a map -

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - Cannot secure connection using TLS -