nancyheidilee nancyheidilee - 1 year ago 67
Git Question

"git show" command showing previous commit

I'm trying to show the contents of a file in a specific commit,
this is the command I'm using:

git show ($commit)^:($filename)

However, it's showing contents of the previous commit.
I'm not sure if this command is supposed to get the contents "before" the commit,
or if it's because the commit I specified was for reverting the previous commit.

Answer Source

The ^ operator means "the ancestor of the given commit". Just remove it, and you should be fine:

$ git show ($commit):($filename)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download