user2656127
user2656127

Reputation: 665

Completely revert a repo and local files to one particular commit state

so I want to remove everything that I have worked on today, both from the git repo and also my local.

i have a commit from yesterday, which I want to revert to. Could i remove the repo and then clone the repo from a specific commit?

thanks!

Upvotes: 0

Views: 172

Answers (1)

TheKojuEffect
TheKojuEffect

Reputation: 21101

You can do reset to make changes to local repo and forcefully push to remote repo.

git reset --hard <commit>
git push --force <remote> <branch>

Warning: Reseting and forcefully pushing will delete the commit history.

Replace <commit>, <remote> and <branch> with the appropriate names like a SHA-hash, origin, and master respectively.

Here, <commit> is the SHA hash of the last commit upto which you wanna reset.

Upvotes: 2

Related Questions