nancyheidilee
nancyheidilee

Reputation: 332

"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.

Upvotes: 1

Views: 71

Answers (1)

Mureinik
Mureinik

Reputation: 310983

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

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

Upvotes: 2

Related Questions