1

How do i see modified lines inside Sublime text 3

Jay Teli
  • 530
  • 1
  • 11
  • 19
  • 2
    What's wrong with `git diff`? – Holloway Dec 10 '15 at 12:51
  • it is not clean for big files and i see characters like ^M... wish i had enough reputation to share image.. Here is something i seee !DOCTYPE HTML>^M^M^M^M^M^M^M^M4Hire Inc^M^M^M^M^M^M – Jay Teli Dec 10 '15 at 13:13
  • 1
    The `^M` is the difference between linux and windows line endings. To ignore these use `git diff --ignore-space-at-eol`. – Holloway Dec 10 '15 at 13:17
  • even above command shows same characters ^M .. image attached – Jay Teli Dec 10 '15 at 13:20
  • 2
    [See here](http://stackoverflow.com/questions/1889559/git-diff-to-ignore-m) – Holloway Dec 10 '15 at 13:26
  • Thanks but even after " git config --global core.autocrlf true" , i get ^M when i do "git diff" – Jay Teli Dec 10 '15 at 13:33
  • ^M in the diff are not random, they are there for a reason. They mean that your editor is set up to use different line endings comparing to the original file and can't preserve them. Set up your editor to use correct line endings and don't try to hide this issue. – Paul Dec 10 '15 at 17:44

2 Answers2

3

Problem solved using Git Gutter

Install Git gutter in Sublime text 3:

cd ~/.config/sublime-text-3/Packages

git clone git://github.com/jisaacks/GitGutter.git

By default, Git Gutter compares your working copy against the HEAD. You can change this behaviour through the ST command palette. The following options are available:

  1. Compare against HEAD
  2. Compare against particular branch
  3. Compare against particular tag
  4. Compare against specific commit

To change the compare option:

Open the command palette (Ctrl-Shift-P for Windows/Linux, Cmd-Shift-P for Mac) Start typing GitGutter You'll see the 4 options listed above, select one with the keyboard. Choose the branch/tag/commit to compare against.

To the left of line numbers we can see the changes add/updated/deleted

Jay Teli
  • 530
  • 1
  • 11
  • 19
1

I know this is an old question, but Sublime offers the subl - command for piping output into a new tab.

git diff | subl -

P.S. To show the full file (including unchanged lines), you could try the command given from this SO answer:

git diff -U$(wc -l MYFILE) MYFILE | subl -
yuyu5
  • 365
  • 4
  • 11