What is in git log?

Hello everyone, It’s Ray!

Today I am going to share with you some detail in git log

Firstly, take a look on the image below:

We could see that there is a long-random-looking string on every commit, and what the heck is that?

This is a checksum produced by Git with SHA1 according to the committed content, by the way, what’s SHA1?

SHA is the abbreviation of “security hash algorithm”

There are several algorithm like this, and, moreover, SHA is not reversible, which means that if you got a hashed string like the one above, you wouldn’t be able to decode and reverse it back to the one before hashed.

If you are interested in that, you could google it. I think google serves as a better teacher than me, lol.

Now I am going to share a very very useful code! Git log --oneline

Type git log --oneline

You could see the difference between git log and git log --oneline

As image shown above, you could see that git takes author, date information off, also only keep 7 characters from the original long-random-looking checksum.

So could we use git checkout that we previously mentioned to switch between different commits?

The answer is yes! Type git checkout cc92d2f (please note that yours will be different from mine, so just type the one shown on your computer)

As photo shown above, we’ve successfully switched to the previous commit

Type git checkout master

Type git log --oneline

Now we are back.

After reading through article today, do you have better understanding on Git?

See you guys!

Deploy multiple projects on AWS How to skip git add?

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×