Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Diff between commits #57

Closed
calvn opened this issue Jun 27, 2016 · 2 comments · Fixed by #388
Closed

Diff between commits #57

calvn opened this issue Jun 27, 2016 · 2 comments · Fixed by #388
Assignees
Milestone

Comments

@calvn
Copy link

calvn commented Jun 27, 2016

First and foremost, this it an awesome package, just what I was looking for! I came across this and spent some time reading the docs, but couldn't find reference to how git-diff can be done, similar to https://godoc.org/github.com/libgit2/git2go#Diff. I noticed that there's https://godoc.org/gopkg.in/src-d/go-git.v3/diff, but this is more for comparison of the contents between a src and dst, which is different from retrieving a list of the diff files between two commits. Is functionality not available in go-git, or did I miss it in the docs?

@mcuadros
Copy link
Contributor

The Diff entity is the bare part of the diff, but currently we don't provide a direct method from a commit for retrieve the diff from the previous file or tree. Sorry

@saurabh95
Copy link

saurabh95 commented Sep 26, 2019

@mcuadros @ajnavarro I was actually trying to use this and it is able to create a patch, but for my use-case, I need to create a format the patch with extra lines in the context which we are able to achieve via format-patch option on git cli

       -U<n>, --unified=<n>
           Generate diffs with <n> lines of context instead of the usual three. Implies --patch.

Is there any similar option available in the library?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants