javascript - Git Diff with data on the command line -
i'm creating ide typescript http://alm.tools/. i'd git diff gutter , have working:
however based on running git diff
on saved file (git diff -u0 path/to/the/file
) (and in fact i forced save file if isn't saved)
i'd diff head
version of file file have in ide memory , not yet commited disk.
from https://git-scm.com/docs/git-diff can't find way.
in git cant it.
why?
you need understand how git diff works.
in short (the commands explain not executed in the same order explained here, made more simple understand process):
when execute git diff
git making list of known files. compare file ones on working directory (in real life executing several diff commands un-tracked, modified , deleted) , list of modification see.
same process apply staging area well.
since git has process physical files (you can read full code here: (https://github.com/git/git/blob/master/diff.c) cannot use must have file.
what can overkill in opinion simulate way git generate files , save blob under .git
folder without have physical file on disk. can done - having file under .git
without phisocal 1 again need execute 4-5 commands crate file. (hash-object
, sha1sum
etc)...
summary
what asking not possible without physical file git can compare. git needs path , sha-1 comparison , if don't have physical file cannot done.
Comments
Post a Comment