Say I'm working on a project and I'm making various commits as I go along
A - B - C - D - E
And I realise that I made a mistake and need to do git reset
to go back to version C.
So I then carry on making commits like this: C - D2 - E2 - F2 - G2 etc.
Where D2 is different to D, E2 is different to E etc.
I then realise that I was right in the beginning, and I need to get back to E.
As long as I have kept a note of the SHA of version E, is this possible by doing git reset hjsdkgjdfg
where hjsdkgjdfg is the hash of E? I've heard git 'cleans up' (deletes) loose ends every now and then - would D and E be classed as 'loose ends'? Does it depend on the type of reset I have done: soft, mixed, hard?
Bearing in mind I'm a beginner, is this the correct sort of workflow? Or is this a terrible way of working?
Thanks