git-js icon indicating copy to clipboard operation
git-js copied to clipboard

Is there a functionality for git diff?

Open aldanchenko opened this issue 2 years ago • 2 comments

Hello,

I'm trying to receive git diff results. Right now I'm just using this raw version

const rawDiff = await git.diff([
                this.branch,
                filePath
            ]);

And after this I'm parsing raw string to object.

Maybe there is some another, more proper way to receive this data using classes/objects?

Thank you!

aldanchenko avatar Jan 25 '23 15:01 aldanchenko

Yes, you can use git.diffSummary() for that

arnaudsm avatar Jan 28 '23 01:01 arnaudsm

Thank you for the reply @arnaudsm.

Unfortunately, this is not quite what I need. I need to know which lines was changed. For example, line 5 was add and line 10 was deleted. Something like this.

aldanchenko avatar Jan 28 '23 10:01 aldanchenko