FreeKB - Git git show command (view file in git)
Git - git show command (view file in git)

The git show command can be used to view the changes made to a file at a specific commit. The syntax of git show is:

git show <commit id>:<path to file>

 

The git log can be used to get the commit id, like this.

afba75a second commit
741785c first commit

 

The git show command can be used to determine the appropriate path to the file.

git show <commit id> --name-only

 

Which will return a result such as:

misc/example.txt

 

In this example, here is how to view the changes made to example.txt at first commit.

git show 741785c:misc/example.txt

 

If the output contains the following, this means that the "foo" line was added and the "bar" line was removed.

+ foo
- bar

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter ece82 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |