C
C#2w ago
Brad

✅ Sourcetree reverse to a certain commit

Hello, I am pretty new to coding and i have been trying to understand Scourcetree, I want to revert back to this highlighted commit and delete every dot above it but I seem to be having trouble understanding how, any help would be appreciated as you can probably tell I am currently ripping my hair out trying to figure this out
No description
4 Replies
Jimmacle
Jimmacle2w ago
git reset --hard <commit sha> will basically rewind your branch back to that commit, but this will break history for anyone else who has this branch make a backup of the whole repo before you do something irreversible i don't know how to do it in the sourcetree gui, it's all git at the end of the day
Brad
BradOP2w ago
i am not that far into this project so i dont mind loosing data plus its just me working on it, guessing that's done in the terminal, is it just a copy paste of git reset --hard <commit sha> or do i have to replace anything? thanks for answering by the way 🙂
Jimmacle
Jimmacle2w ago
you have to replace <commit sha> with the SHA hash of the commit you want to revert to, and run it inside your repository's root folder you could also just delete the branch and check out a new one off main since it looks like origin/main is still at that revision
Brad
BradOP2w ago
All fixed now thank you again 🙂

Did you find this page helpful?