Getting the difference between two repositories
In repo_a: git remote add -f b path/to/repo_b.git git remote update git diff master remotes/b/master git remote rm b
In repo_a: git remote add -f b path/to/repo_b.git git remote update git diff master remotes/b/master git remote rm b
Git’s “similarity index” computation is not, as far as I know, documented anywhere other than in the source, starting with diffcore-delta.c. To compute the similarity index for two files S (source) and D (destination), Git: reads both files computes a hash table of all of the chunks of file S computes a second hash table … Read more
You could use git whatchanged –since=”1 day ago” -p It also takes a –until argument. Docs
git diff-tree -r –no-commit-id –name-only –diff-filter=ACMRT $commit_id git diff-tree -r $commit_id: Take a diff of the given commit to its parent(s) (including all subdirectories, not just the top directory). –no-commit-id –name-only: Do not output the commit SHA1. Output only the names of the affected files instead of a full diff. –diff-filter=ACMRT: Only show files added, … Read more
Use git diff. git diff [<options>] <commit>..<commit> [–] [<path>…] <commit> is a branch name, a commit hash, or a shorthand symbolic reference. Examples: git diff abc123..def567, git diff HEAD..origin/master. That will produce the diff between the tips of the two branches. If you’d prefer to find the diff from their common ancestor to test, you … Read more
The important thing to realize about git diff A B is that it only ever shows you the difference between the states of the tree between exactly two points in the commit graph – it doesn’t care about the history. The .. and … notations used for git diff have the following meanings: So when … Read more
From the git-diff manpage: git diff [–options] <commit> <commit> [–] [<path>…] For instance, to see the difference for a file “main.c” between now and two commits back, here are three equivalent commands: $ git diff HEAD^^ HEAD main.c $ git diff HEAD^^..HEAD — main.c $ git diff HEAD~2 HEAD — main.c
First, make sure you’re using the coloured output (e.g. with git diff –color) and that you’ve enabled whitespace highlighting with (e.g.) git config color.diff.whitespace “red reverse” This might not work in all cases, however, as git doesn’t appear to highlight trailing whitespace for removed lines. To see whitespace that you’ve deleted, simply use git diff … Read more
GitHub suggests that you should make sure to only use \n as a newline character in git-handled repos. There’s an option to auto-convert: $ git config –global core.autocrlf true Of course, this is said to convert crlf to lf, while you want to convert cr to lf. I hope this still works … And then … Read more
Lets take a look at example advanced diff from git history (in commit 1088261f in git.git repository): diff –git a/builtin-http-fetch.c b/http-fetch.c similarity index 95% rename from builtin-http-fetch.c rename to http-fetch.c index f3e63d7..e8f44ba 100644 — a/builtin-http-fetch.c +++ b/http-fetch.c @@ -1,8 +1,9 @@ #include “cache.h” #include “walker.h” -int cmd_http_fetch(int argc, const char **argv, const char *prefix) +int … Read more