Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I jump back in my commits without making any changes?

Tags:

git

I want to jump to a previous commit with the ability to jump out of it at anytime, not affecting my repo. What would I use to do this in git?

Thanks!

like image 657
fancy Avatar asked Sep 01 '25 04:09

fancy


2 Answers

You'd have to commit or stash your working tree changes, but you can

git checkout <sha1 of previous commit>
like image 111
Conner Avatar answered Sep 02 '25 18:09

Conner


This can be done with git checkout. But I recommend reading a book about git which explains how you can use git. Progit is a good and free online book.

like image 23
Ikke Avatar answered Sep 02 '25 20:09

Ikke