We had a snafu tonight where code checked into git (which gets auto pushed to our application if pushed to the master branch) that caused our site to go down for a bit. I restored an EC2 snapshot to get the site back up, but now I need to cleanup git and get us back on track.
It looks like I need to find the last successful commit to the master branch, grab the first 8 or so characters of it's sha1 id, and run this:
git reset --hard jfe2ldj2
git push origin master -f
Once I do that, everything on the master branch from commit "jfe2ldj2" an later will be wiped from git and can never be recovered. Am I understanding that correctly?
Also, this will not effect any other branches or commits correct? Meaning, that once I run that command and bring the master branch back to say 6 weeks ago, all of the other branches will remain current. Meaning that if I have a number of release and feature branches and they all have multiple commits since 6 weeks ago, all of those branches and commits will still be there?