i'm new git , need command.
so have cloned repository in git, , want see difference in insertions , deletions between 2 commits closest 2 dates.
i know how history commit commit between 2 dates bellow:
$ git log --since "jan 1 2014" --until "dec 31 2014" --oneline --shortstat origin/master but how can compare 2 commits first closest jan 1 2014 , second closest dec 31 2014 , total difference between files in both commit versions? not commit commit , add upp total difference difference in commit 1 (jan 1) , commit 2 (dec 31) , skip commits in between commits, in 1 line example
51647f3: 340 files changed, 1316 insertions(+), 6676 deletions(-) also question, insertions include modded lines or actual new lines?
thanks in advance.
you can use git diff , provide a range of commits using .. notation:
git diff <firstcommit>..<secondcommit> --shortstat in git commit points snapshot of repository's directories , files. when compare 2 commits you're comparing state of files @ different points in time, regardless of how many commits (i.e. "snapshots") have happened in between.
you can find sha-1 hash of first commit occurred after or before specific date starting origin/master using git rev-list:
git rev-list --since="jan 1 2014" --reverse origin/master | head -1 git rev-list --until="dec 31 2014" -n 1 origin/master where head used in first case instead of -n switch select first line in output. reason --reverse applied after filtering options:
note these applied before commit ordering , formatting options, such
--reverse.
as second question, according unified diff format, modified line counts insertion (+) new line , deletion (-) old one:
+ modified line - line so count both.
Comments
Post a Comment