Skip to content

Instantly share code, notes, and snippets.

@chhuang
Created July 27, 2016 06:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chhuang/64b4f616933914e988349c7fecc8f461 to your computer and use it in GitHub Desktop.
Save chhuang/64b4f616933914e988349c7fecc8f461 to your computer and use it in GitHub Desktop.
Show Git history for a specific line in Sublime

Don't use blame because git blame only shows the LAST commit of that particular line.

  1. Install sublime-text-git
  2. shift + command + p in Sublime
  3. Type in Custom command
  4. Select Git: Custom Command. It'll open a panel at the bottom of Sublime.
  5. Type in log -L START_LINE_NUMBER,END_LINE_NUMBER:CURRENT_FILE_NAME.EXT

For example: log -L 1,1:index.js will show the git history for line #1 of index.js.

@sergey-alekseev
Copy link

Thanks for sharing! I often need this and didn't know it's possible with git log -L .... Also just installed and found Sublime Merge allows to do this nicely
Screen Shot 2020-11-05 at 18 14 59

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment