Git is supposed to be a tool for easily switching back to test things and then getting back to what you were doing. Sometimes I switch back to an old commit by doing
git checkout old_commit_id
then to get back I do
git checkout latest_commit_I_did
and start doing work. Then I commit this work.
git commit -m "did some work"
Then I go back to another commit with
git checkout another_old_commit_id
Then my commit did some work
is simply LOST forever. Why it's so easy to lose a ton of work on git? Since git checkout latest_commit_I_did
is the last commit I did, why it simply not added my commit on top of this one?
I think it has something to do with it not knowing in which branch I am but it should, at least warn me. Why simply delete everything I did with no warnings? I've already lost some important works because of this.