Thursday, October 6, 2016

Revert Git changes

To rollback to a specific revision on github (Helpful if you accidentally merged and pushed to branch)

# switch to branch you need to rollback
git checkout branch_name

# make sure you have the updated version
git pull

# rollback to specific version
git reset --hard 56e08f23

# push your changes back to github
git push -f




To remove a specific commit that has been pushed to remote repos

#Identify the commit hash
git revert -m 1 56e08f23

# confirm the revert was correctly done and push back up to remote repos
git push -f

No comments:

Post a Comment