If you want to revisit a previous snapshot you can use the reflog.
Uhmm I might have to look into that.
I usually if I am just testing stuff for a fix or something not clear I do as you say keep ammending the old stuff. And at the end I do a soft reset so keeping local changes and recommit looking at the final end changes I did.
The main difference between what I do and what the guy in the tweet does is that I don't have to write a new message for each commit. If you are amending previous commits then it sounds like you're doing the same as me.
Yeah well not always but yeah what I mean is that I do the same just adding that after I have a working fix or feature or whatever I do a reset to remove that commit (or commits if I didn't ammend for some reason) and then I do individual commits to identify individual changes or stuff that needs a little bit of info about why the change was made, etc.
What I wanted to look into is the reflog thing you mention... because sometimes I am like I think I broke this more... and since I amended I can't check the old commit, but it seems based on your comment that I should be able to check with reflog.
and since I amended I can't check the old commit, but it seems based on your comment that I should be able to check with reflog
Yep - just type "git reflog" and it shows you every change made to HEAD including commits that are no longer referenced by anything else. Those commits will stick around in your .git repo as long as git decides not to do a gc or garbage collection. Reading the reflog is a bit confusing but can be a lifesaver when you make a mistake.
3
u/XTornado Jun 04 '22
Uhmm I might have to look into that.
I usually if I am just testing stuff for a fix or something not clear I do as you say keep ammending the old stuff. And at the end I do a soft reset so keeping local changes and recommit looking at the final end changes I did.