1

I have committed a few test text from my vim editor to a sample main branch.

When I use $cat (commit) to view various versions across branches, my editor simply clears as if I typed $clear.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
John James
  • 13
  • 4
  • Are you typing the literal command `cat; (commit)`? If so, what does your `commit` command do? Note that neither `cat` nor `commit` is a *Git* command. Git-bash has nothing to do with Git itself, it's just a port of Bash to Windows so that Windows users can use Git (which needs a POSIX-style shell, and bash provides one). If you are typing `(commit)`, note that to bash, this means run the `commit` command in a sub-shell; if that clears your screen, that would do the job. – torek Jun 25 '22 at 11:51
  • (Note further that `cat (commit)` just produces a syntax error, so I'm sure that's not what you're actually typing. See [mre] - providing a reproducible example helps others to help you!) – torek Jun 25 '22 at 11:54

1 Answers1

1

You can use git show to see the content of a file in a different branch

git show somebranch:path/to/your/file

Or you can define a git cat alias

[alias]
  cat = "!git show \"$1:$2\" #"

Which means you can type git cat somebranch path/to/your/file.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250