Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get information about a SHA-1 commit object?

Tags:

git

I searched for a topic of interest in a commit log:

$ git log --pretty=oneline | grep -i ...  $SHA1 < ... commit message ... > 

I now have a SHA1, and I want to know information about the files affecting that SHA1 and maybe later diff them with their parent. How can I get this done?

like image 541
Vaibhav Bajpai Avatar asked Sep 30 '11 12:09

Vaibhav Bajpai


People also ask

How do you get details of a commit?

`git log` command is used to view the commit history and display the necessary information of the git repository. This command displays the latest git commits information in chronological order, and the last commit will be displayed first.

How do you find the Sha of a commit?

If you have the hash for a commit, you can use the git show command to display the changes for that single commit. The output is identical to each individual commit when using git log -p .

What is SHA1 of commit?

The SHA1 of the commit is the hash of all the information. And because this hash is unique to its content, a commit can't change. If you change any data about the commit, it will have a new SHA1. Even if the files don't change, the created date will. A commit is a code snapshot.

What does commit object contain in git?

The commit object contains the directory tree object hash, parent commit hash, author, committer, date and message.


1 Answers

git show <SHA1> will show the commit date, author, parent, and diff of files that changed from parent commit.

like image 71
CharlesB Avatar answered Nov 01 '22 04:11

CharlesB