Comments (7)
I'm not sure I understand completely...do you want to compare HEAD with your working tree?
If so, what's the difference between git diff-index -M HEAD
and git diff HEAD
?
from vim-gitgutter.
Short version; the diff-index skips the index.
Long version;
try this;
- edit a (previously committed) file, deleting some lines or adding some.
- Use 'git add ' on it.
- Open same file agan and edit it some more.
Using 'git diff' you will see the changes you made in step 3, not the changes you made in step 1.
Using 'git diff-index -M HEAD -U3' you will see the differences accumulated of stuff you did in step 1 and AND step 3.
I think the latter (the diff-index) is more correct as thats the changes made since you last committed.
I personally think that the vast majority of git users work around the index and try to avoid things like 'git reset'/'git add' etc. Thats naturally not a scientific fact, but my experience. At minimum when I teach git to people I tell them to avoid it, as its really not easy to grasp the concept of an invisible version of your file thats in the index IMOHO.
As such I think this is great thing to avoid surprises by those users.
from vim-gitgutter.
OK, I see the difference between git diff
and git diff-index -M HEAD -U3
. But I don't see any difference between the latter and git diff HEAD
...?
The reason I prefer git diff HEAD
to git diff-index -M HEAD -U3
is the former is possible right now with vim-gitgutter.
from vim-gitgutter.
I think you are right that there is no difference, you could make my change simpler by just using 'diff HEAD' in there.
It looks like two correct solutions to my problem that currently gitgutter doesn't show changes made before a 'git add'.
Not sure if I understand your stentence '..the former is possible right now with vim-gitgutter'. I probably missed something :)
from vim-gitgutter.
I think adding this to your vimrc will do the trick:
let g:gitgutter_diff_args = 'HEAD'
from vim-gitgutter.
After updating my gitgutter git repo to HEAD, and adding that line, it seems to work as expected :)
lots of changes in this project!
from vim-gitgutter.
Glad it's working for you!
Lots of changes, yes, though it's settling down now :)
from vim-gitgutter.
Related Issues (20)
- g:gitgutter_close_preview_on_escape is broken when exists('*nvim_open_win') HOT 2
- vim-gitgutter clobbers v:shell_error via autocmd ShellCmdPost HOT 7
- File renames aren't handled properly HOT 13
- Error detected while processing CursorHold HOT 14
- g:gitgutter_diff_base () is invalid HOT 4
- Neovim Nightly Issue HOT 2
- Neovim now prefers extmarks to signs HOT 3
- errors when file path includes colons HOT 3
- Performance issues after base_path fix HOT 5
- Branch rename breaking installations? HOT 2
- g:gitgutter_diff_base () is invalid HOT 10
- Performance issues with big files in the repository HOT 3
- cursorline highlighting doesn't work with gitgutter HOT 3
- gutter colors not showing change on correct line HOT 1
- No hunks (file possibly recognized as binary file) HOT 5
- GitGutterLineHighlightsToggle doesn't update immediately on neovim HOT 3
- GG doesn't show file changes when in a worktree HOT 3
- key map expr needs more backslashes? HOT 1
- GitGutterPreviewHunk error HOT 1
- files are not tracked (no hunk in file) HOT 31
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vim-gitgutter.