Undo last commit/merge

Your feature branch will still point to your work. You will not lose those changes.

As plaes said, you can reset master back one with

git reset --hard HEAD^

If you want to grab some specific files from your branch without merging, you can check them out:

git checkout yourbranch -- file1 file2 etc

If you want some files from master from before the merge you can also check these out:

git checkout master^ -- file3 file4 etc

This is not ideal but it is what is needed sometimes. A merge /may/ mean that you reject some changes from either side in a merge. The best way to attain a proper merge is to:

git merge --no-commit yourbranch

from master, then run the git checkout commands from above and finally commit:

git add . -A
git commit

When you push this branch now, you will need to add the force option

git push --force

or

git push -f

Hope this helps.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)