Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.15 KB

File metadata and controls

47 lines (33 loc) · 1.15 KB

Git Show

To see the Status of Single Commit

# Shows status of last commit
git show

# Shows Status of particular Commit
git show commitId
git show HEAD~x

# Shows filenames only of modified files
git show --name-only

# Shows filenames along with short status of files
git show --name-status

To see the final version of some file in some Commit

git show commitId:file1.txt
git show HEAD~x:file1.txt

In above command we access final versions of files using filenames, There is another way we can get Ids of each of those final versions of files in each commit.

# List all the files and directories modified in that Commit with unique Ids
git ls-tree commitId
git ls-tree HEAD~x

# List the content of Hierarchical Object
git ls-tree objectId

In output, Tree represents a Directory and Blob represents a File.

We can take Blob Id as ObjectId to see the final version of a file

# Shows content of Non-Hierarchical Object
git show objectId

For ObjectId, If it is of a Blob then we'll be able to see the Content of file but if it is of Tree then we'll get a list of files and directories in it.