Posted in GIT

Git revert back to older commit

You have multiple commits in a branch but all gone wrong somehow and now you want to revert back to a specific commit. This is how you do:

Situation 1: Reverting to older commit

Danger Alert: All your uncommitted changes will be lost doing this. If you have such, prefer next situation.

git reset --hard <commit_code>
git commit -m "Reverted to <commit_code>"

Replace <commit_code> with your commit SHA Eg. 9acbb770

Continue reading “Git revert back to older commit”

Posted in Code Snippets, GIT

Git pull : Ignoring local changes

When you are in a situation to initiate git to a directory which is already developed and you need to pull changes from the remote ignoring local changes, you will not be allowed to use:

git pull origin master

Continue reading “Git pull : Ignoring local changes”