git - Undo last commit/merge -


i have messed git repo little. worked on feature in separate branch. after finishing work, switched master merge into, partner pushed few files came conflict mine. after merge, conflict , pushing new changes, saw committed older changes of partner too.

now want redo commit/merge. tried git reset --soft head^ when wanted push, got error message merge remote changes before pushing again.

can me?

your feature branch still point work. not lose changes.

as plaes said, can reset master 1 with

git reset --hard head^ 

if want grab specific files branch without merging, can check them out:

git checkout yourbranch -- file1 file2 etc 

if want files master before merge can check these out:

git checkout master^ -- file3 file4 etc 

this not ideal needed sometimes. merge /may/ mean reject changes either side in merge. best way attain proper merge to:

git merge --no-commit yourbranch 

from master, run git checkout commands above , commit:

git add . -a git commit 

when push branch now, need add force option

git push --force 

or

git push -f 

hope helps.


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -