git log reverse and then limit the results to one -
i @ commit on master, , need next commit wrt origin/master.
git log --ancestry-path --date-order --reverse head..origin/master or similar git rev-list command gives me right commits, reversed, |head -n 1 , done it.
however, wonder it's possible using 1 process (one git invokation). limiting -1 limits first, , reverses list, not need.
how accomplish this?
i know dag is, know enough graph theory understand why -1 behaves that. i'm asking here not matter of theory, it's matter of using tool used in software development.
i'm 90% confident can't done in single git invocation 2 reasons.
it doesn't they've implemented it. commits have pointers parents, not children, why
--max-count(-1) ,--skip(which tried bit) run before--reverse. since git's capable of printing in--reverseor not, seems running-1afterwards should technically feasible, perhaps there's underlying reason it's not. or perhaps considered , decided--reverse | head -n 1you're doing.more importantly, you're not guaranteed unique next commit, when using
--ancestry-path, picking--reverse -1ambiguous. here's example--ancestry-pathdescription in git-log docs,headcommite. if you're happy--date-order, it's more of academic issue, dag nature of git makes whole "next commit" concept unsound.
as example use case, consider following commit history:
d---e-------f / \ \ b---c---g---h---i---j / \ a-------k---------------l--ma regular d..m computes set of commits ancestors of m, excludes ones ancestors of d. useful see happened history leading m since d, in sense “what m have did not exist in d”. result in example commits, except , b (and d itself, of course).
when want find out commits in m contaminated bug introduced d , need fixing, however, might want view subset of d..m descendants of d, i.e. excluding c , k. --ancestry-path option does. applied d..m range, results in:
e-------f \ \ g---h---i---j \ l--m
Comments
Post a Comment