Software repository uses a unique ID to define a commit (revision). CSV or SVN use a incremental number as an ID. But in git the commit ID is the SHA-1 of the change set . The question now will be, how to check out, revert or diff latest changes to some past commit?
Commit ID in git looks like this:
You can also refer the commit ID using the first 7 character of the SHA-1, like:
Let’s say you want to revert your latest commit to one commit before yours, you can do
git checkout sha_1~x file/name
where sha_1 is your current commit ID and x is how many commits you want to go back.
So if you want to make a diff from your current file to a file which is 6 commits back:
git diff xyz123~6 file/name
Happy gitting 🙂