git show old version of file in editor


I figured out I can show old versions of a file using 'git log filename' to show the commits, and then use 'git show commit-id:filename' for the old version. But it just puts it in less.

I would like to be able to view this in emacs, so I can navigate as I'm used to and so that there is syntax highlighting. I found out I can't set the git core.pager to emacs since emacs cannot read from stdin.

Does anyone know how I could do this? Or do you have another good way of checking old versions of files?


Just use > and put it into a file that you can open in emacs.

git show commit-id:filename > oldfile

Then open the file in emacs.


If you are using bash, you can use Process Substitution.

gvim <(git show commit-id:filename)

Emacs package git-timemachine lets you step back and forth through git revisions of a file:



Using the following Vim command, one can view a previous version of a file without having to cleanup anything afterward.

git show commit-id:filename | vim - -n

Explanation: The dash argument of the vim command makes vim load whatever comes in from standard input. The -n option suppresses the creation of swap files.



  • Make gcc the default compiler of make
  • Replace everything between [ and ] in regex java
  • what is difference between using concerns vs modules in rails?
  • Getting all nouns related to a verb in WordNet using JWNL
  • transparency issues with repeated stamping of textures on an MTKView
  • How to Draw a Rubber Band Selection Rectangle accurately on a Rotated Canvas?
  • OpenPIV Installation Error
  • User Role Select on Woocommerce Registration Stopped Working
  • iOS screenshot live camera preview
  • iPhone/iPad: animated splash screen?
  • boto3 S3 Object Parsing
  • Flexible array member and pointer member : pros and cons?
  • scipy.signal's convolve differs from calculated result
  • “We were able to connect to the database server” error in WordPress
  • Access IPV6 with IPV4 [closed]
  • Adding DateTimePicker to Userform
  • how do I array from a GET request function in viewdidload function in swift
  • Select list scroll to a specific option element
  • How to list all Call logs from Log list including Sms and email logs also?
  • Calling JavaScript function in WebView
  • Identify xml text elements with Schematron
  • Octopress --> Heroku error env: bundle: no such file or directory
  • Retrieving Application's DisplayName/UninstallString from Registry Using Powershell
  • Pyinstaller GLIBC_2.15 not found
  • Move elements from a listbox to another
  • Find corners of a rotated rectangle
  • How can I filter an array of dictionaries in 'updateSearchResultsForSearchController' to s
  • Multiple canvases (pages) in Fabric.js
  • content must have a ListView whose id attribute is 'android.R.id.list'
  • Find angle of point on circle
  • Zoho API: Get the user that is making the request
  • How to include associated objects using gon in Rails/jQuery
  • How can I ssh into a server that requires 2 password authentication using python's paramiko mod
  • Android: Unable to detect vertical plane
  • VSTS work items list through REST API
  • Debug `Unexpected end of JSON input Error` on content script
  • Apple Mach-O Linker error (“duplicate symbol”)
  • Background transfer download task failed when app was closed
  • XEP-0166: Jingle protocol implementation for voice/video chat in iOS
  • Angular FormGroup won't update it's value immediately after patchValue or setValue