As I read through as many sources on how to use git, I haven't come across any article which suggests when you can rollback should the need arise. So for example I have initialized a git directory in my working directory i.e. git init
I then add files to git's index i.e. git add .
. This has added all files to git's index. Now rather than committing the files to git's repository i.e. git commit
, I make a change to one of the files I added to the index. I realize I made a mistake. Can I rollback to the previous state or is this only possible when I have committed the file? My understanding is that when I run the command git add .
a copy of the file or files is made in git's object store. I believe the files in the object store are compressed. Does this mean I can rollback from the object store?