Then we could execute this lines:
git rebase -i HEAD^^
git rebase -i <commit_sha2>
git difftool <commit_sha> <file_name> -y
git diff <commit_sha> <file_name>
git reset <commit_sha> <file_name>
git checkout <file_name>
git: undo a merge?
After executing this command our master branch will look identical to origin/master:
git reset --hard origin/master
With git log we can check which commit is one prior the merge. Then you we can reset it using:
git reset --hard commit_sha
Go back by 5 commits:
git reset --hard HEAD~5
File not ignored when it is added to .gitignore
Problem can be that this file is still in the git cache. To slow this problem needs to reset git cache.
git rm -r --cached .
This removes everything from the index, then just run:
git add .
git commit -m ".gitignore was fixed."