Questions tagged [git-show]

Shows one or more objects (blobs, trees, tags and commits).

  • For commits it shows the log message and textual diff. It also presents the merge commit in a special format as produced by git diff-tree --cc.

  • For tags, it shows the tag message and the referenced objects.

  • For trees, it shows the names (equivalent to git ls-tree with --name-only).

  • For plain blobs, it shows the plain contents.

The command takes options applicable to the git diff-tree command to control how the changes the commit introduces are shown.

See the man page for more info.

78 questions
3520
votes
30 answers

How do I list all the files in a commit?

How can I print a plain list of all files that were part of a given commit? Although the following lists the files, it also includes unwanted diff information for each: git show a303aa90779efdd2f6b9d90693e2cbbbe4613c1d
Philip Fourie
  • 111,587
  • 10
  • 63
  • 83
130
votes
5 answers

How to get git to show commits in a specified date range for author date?

Apparently this: git log --all --after=" 00:00" --before=" 23:59" --author="" filters commits based on the committer date. How can I make it show commits for a specified author date range ?
Mr_and_Mrs_D
  • 32,208
  • 39
  • 178
  • 361
64
votes
8 answers

How to list ALL git objects in the database?

Is there a better way of getting a raw list of SHA1s for ALL objects in a repository than: ls .git/objects/??/\* and cat .git/objects/pack/*.idx | git show-index I know about git rev-list --all but that only lists commit objects that are referenced…
kbro
  • 4,754
  • 7
  • 29
  • 40
43
votes
1 answer

git log -p vs. git show vs. git diff

How are the commands git log -p, git show, and git diff related and why would one be used over another? Given a repo with the following 4 commits: commitd - last commit commitc commitb coomita - initial commit What are the differences…
Roy Lambert
  • 433
  • 1
  • 4
  • 5
19
votes
3 answers

Using `git show` to create and apply patches spanning multiple commits

Lately I've been using git show to create diffs for later reference because it's easier to type than git diff ~ and it shows the commit information (timestamp, user, hash, comment). You can then use git apply to apply…
redbmk
  • 4,687
  • 3
  • 25
  • 49
15
votes
2 answers

What does `git show` do all by itself?

If I use git show all by itself in a git repo it shows a bunch of information such as commits, diffs, etc. This page (https://git-scm.com/docs/git-show) just says: Shows one or more objects (blobs, trees, tags and commits). I assume it's the latest…
Snowcrash
  • 80,579
  • 89
  • 266
  • 376
15
votes
2 answers

How to view files in bare repositories?

I have a bare repository in my remote. I want to look at files, that is open in an editor and view the code. For listing files, git ls-files master or git ls-tree master. and for viewing single file, I could do git show 100644 But how do I view…
brain storm
  • 30,124
  • 69
  • 225
  • 393
13
votes
2 answers

Difference between `git stash show -p stash@{N}` and `git show stash@{N}`?

I thought they should be basically the same, but when I tried $ git stash show -p stash@{N} and $ git show stash@{N} the latter shows some additional commit information, but the actual diff was much, much shorter. (The former shows about a dozen…
musiphil
  • 3,837
  • 2
  • 20
  • 26
6
votes
1 answer

How to git show a staged file?

I can do git show :path/to/some/file but what do I replace to get the currently staged version of the file? Context: I'm writing a pre-commit hook and I want to run a check on the staged files without resorting to stashing…
parched
  • 451
  • 6
  • 11
6
votes
2 answers

how to read git show command output

I am just getting into VC and in particular git. I am aware of basic commands like git add/commit/remote but having a hard time understanding the output: $ git show f27d852 commit f27d852fc750a9c3f71eaf0acf586164b76faddf Author: myusername…
dkjain
  • 831
  • 1
  • 9
  • 36
6
votes
1 answer

git show to view prior version of a renamed file?

We renamed a file where git log --follow my/new-file correctly shows changes before and after the rename. But this command does not work to show a prior version: git show :my/new-file. We have to run git show :my/old-file. Is there a…
Marcus Leon
  • 55,199
  • 118
  • 297
  • 429
5
votes
5 answers

Why does git show filename display a diff?

git show filename diplays a diff, while git show branch:path/to/filename displays the content of the file. I look in the help (git show --help) and what I understood is that it should default to HEAD, i.e. git show HEAD:filename. But that produces…
odCat
  • 98
  • 8
5
votes
2 answers

How can I get "git show" to show diffs with full context?

I am reviewing a very old commit. I want to see the changes a particular commit made but I want to see that in full context, i.e. I want to see whole file and the changes that person had made. The following command, git show -w is not…
MAG
  • 2,841
  • 6
  • 27
  • 47
5
votes
2 answers

Git show whole file changes

Is there a way to get the git show command to show the whole contents of a file when viewing a commit? For example: if it currently show something like foo.cpp +++ int main() { +++ std::cout << "HELLO" << std::endl; +++ } I would want the…
Lily Mara
  • 3,859
  • 4
  • 29
  • 48
5
votes
1 answer

How can I preserve line endings when I check out a single file to a different location with git?

I want to checkout a single file from a git repository to a different location (other than working dir) and leave my current working dir as it is. And I want git to checkout my file with correct line endings. I work on Windows but I have the same…
1
2 3 4 5 6