{"thread":{"id":"7436","subject":"Listing of branch creation time?","startedAt":"2007-03-27T21:52:06Z","lastAt":"2007-07-23T23:38:40Z","messageCount":17,"participants":["Bill Lear","Johannes Schindelin","Jeff King","David Lang","Linus Torvalds","Nicolas Pitre","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"38189","messageId":"17929.37382.984339.742025@lisa.zopyra.com","threadId":"7436","inReplyTo":null,"subject":"Listing of branch creation time?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-27T21:52:06Z","receivedAt":"2007-03-27T21:52:06Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"I'm sure the git developers grow tired of working with addle-brained\nusers, but I sometimes forget what the contents of a topic branch are,\nhow old it is, etc.  As to content, I can make better branch names,\nbut I think it would be useful to be able to query git as to the\ncreation time of all of my branches, perhaps sorted from newest to\noldest.\n\nWould it be reasonable to add an option to git-branch to do this?\n\n\nBill\n"},{"id":"38196","messageId":"Pine.LNX.4.63.0703280056140.4045@wbgn013.biozentrum.uni-wuerzburg.de","threadId":"7436","inReplyTo":"17929.37382.984339.742025@lisa.zopyra.com","subject":"[PATCH] git-branch: add --sort-by-date option","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-03-27T23:03:57Z","receivedAt":"2007-03-27T23:03:57Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nWith `--sort-by-date`, git-branch prints the refs sorted by date of the\nrefs' tips (newest first). If this option is combined with `-v`, also\nprint the dates of the tips.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Tue, 27 Mar 2007, Bill Lear wrote:\n\n\t> [...] I sometimes forget what the contents of a topic branch \n\t> are, how old it is, etc.  As to content, I can make better \n\t> branch names, but I think it would be useful to be able to query \n\t> git as to the creation time of all of my branches, perhaps \n\t> sorted from newest to oldest.\n\n\tThis is only lightly tested, and I will not have time to work any \n\tmore on this. So, if this does not what you want, you will have to \n\tfix it yourself.\n\n Documentation/git-branch.txt |    5 +++-\n builtin-branch.c             |   52 +++++++++++++++++++++++++++++++++--------\n 2 files changed, 46 insertions(+), 11 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex 603f87f..ca32d5d 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -9,7 +9,7 @@ SYNOPSIS\n --------\n [verse]\n 'git-branch' [--color | --no-color] [-r | -a]\n-\t   [-v [--abbrev=<length> | --no-abbrev]]\n+\t   [-v [--abbrev=<length> | --no-abbrev]] [--sort-by-date]\n 'git-branch' [--track | --no-track] [-l] [-f] <branchname> [<start-point>]\n 'git-branch' (-m | -M) [<oldbranch>] <newbranch>\n 'git-branch' (-d | -D) [-r] <branchname>...\n@@ -91,6 +91,9 @@ OPTIONS\n --no-abbrev::\n \tDisplay the full sha1s in output listing rather than abbreviating them.\n \n+--sort-by-date::\n+\tInstead of sorting by name, sort the refs by date of their tips.\n+\n <branchname>::\n \tThe name of the branch to create or delete.\n \tThe new branch name must pass all checks defined by\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex a4494ee..8deb155 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -12,7 +12,7 @@\n #include \"builtin.h\"\n \n static const char builtin_branch_usage[] =\n-  \"git-branch [-r] (-d | -D) <branchname> | [--track | --no-track] [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [--color | --no-color] [-r | -a] [-v [--abbrev=<length> | --no-abbrev]]\";\n+  \"git-branch [-r] (-d | -D) <branchname> | [--track | --no-track] [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [--color | --no-color] [-r | -a] [-v [--abbrev=<length> | --no-abbrev]] [--sort-by-date]\";\n \n #define REF_UNKNOWN_TYPE    0x00\n #define REF_LOCAL_BRANCH    0x01\n@@ -236,8 +236,26 @@ static int ref_cmp(const void *r1, const void *r2)\n \treturn strcmp(c1->name, c2->name);\n }\n \n+static int ref_cmp_by_author_date(const void *r1, const void *r2)\n+{\n+\tstruct ref_item *i1 = (struct ref_item *)r1;\n+\tstruct ref_item *i2 = (struct ref_item *)r2;\n+\tstruct commit *c1 = lookup_commit(i1->sha1);\n+\tstruct commit *c2 = lookup_commit(i2->sha1);\n+\tif (!c1 || parse_commit(c1))\n+\t\treturn +1;\n+\tif (!c2 || parse_commit(c2))\n+\t\treturn -1;\n+\tif (c1->date < c2->date)\n+\t\treturn +1;\n+\telse if (c1->date > c2->date)\n+\t\treturn -1;\n+\treturn 0;\n+}\n+\n+\n static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n-\t\t\t   int abbrev, int current)\n+\t\t\t   int abbrev, int current, int show_author_date)\n {\n \tchar c;\n \tint color;\n@@ -264,11 +282,17 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n \n \tif (verbose) {\n \t\tcommit = lookup_commit(item->sha1);\n-\t\tif (commit && !parse_commit(commit))\n+\t\tif (commit && !parse_commit(commit)) {\n+\t\t\tint offset = 0;\n+\t\t\tif (show_author_date)\n+\t\t\t\toffset = snprintf(subject, sizeof(subject),\n+\t\t\t\t\t\"%s \", show_date(commit->date, 0,\n+\t\t\t\t\tDATE_SHORT));\n \t\t\tpretty_print_commit(CMIT_FMT_ONELINE, commit, ~0,\n-\t\t\t\t\t    subject, sizeof(subject), 0,\n+\t\t\t\t\t    subject + offset,\n+\t\t\t\t\t    sizeof(subject) - offset, 0,\n \t\t\t\t\t    NULL, NULL, 0);\n-\t\telse\n+\t\t} else\n \t\t\tstrcpy(subject, \" **** invalid ref ****\");\n \t\tprintf(\"%c %s%-*s%s %s %s\\n\", c, branch_get_color(color),\n \t\t       maxwidth, item->name,\n@@ -280,7 +304,8 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n \t}\n }\n \n-static void print_ref_list(int kinds, int detached, int verbose, int abbrev)\n+static void print_ref_list(int kinds, int detached, int verbose, int abbrev,\n+\tint sort_by_date)\n {\n \tint i;\n \tstruct ref_list ref_list;\n@@ -289,7 +314,8 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev)\n \tref_list.kinds = kinds;\n \tfor_each_ref(append_ref, &ref_list);\n \n-\tqsort(ref_list.list, ref_list.index, sizeof(struct ref_item), ref_cmp);\n+\tqsort(ref_list.list, ref_list.index, sizeof(struct ref_item),\n+\t\tsort_by_date ? ref_cmp_by_author_date : ref_cmp);\n \n \tdetached = (detached && (kinds & REF_LOCAL_BRANCH));\n \tif (detached) {\n@@ -299,7 +325,8 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev)\n \t\thashcpy(item.sha1, head_sha1);\n \t\tif (strlen(item.name) > ref_list.maxwidth)\n \t\t\t      ref_list.maxwidth = strlen(item.name);\n-\t\tprint_ref_item(&item, ref_list.maxwidth, verbose, abbrev, 1);\n+\t\tprint_ref_item(&item, ref_list.maxwidth, verbose, abbrev, 1,\n+\t\t\tsort_by_date);\n \t\tfree(item.name);\n \t}\n \n@@ -308,7 +335,7 @@ static void print_ref_list(int kinds, int detached, int verbose, int abbrev)\n \t\t\t(ref_list.list[i].kind == REF_LOCAL_BRANCH) &&\n \t\t\t!strcmp(ref_list.list[i].name, head);\n \t\tprint_ref_item(&ref_list.list[i], ref_list.maxwidth, verbose,\n-\t\t\t       abbrev, current);\n+\t\t\t       abbrev, current, sort_by_date);\n \t}\n \n \tfree_ref_list(&ref_list);\n@@ -530,6 +557,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \tint verbose = 0, abbrev = DEFAULT_ABBREV, detached = 0;\n \tint reflog = 0, track;\n \tint kinds = REF_LOCAL_BRANCH;\n+\tint sort_by_date = 0;\n \tint i;\n \n \tgit_config(git_branch_config);\n@@ -610,6 +638,10 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\t\tbranch_use_color = 0;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!strcmp(arg, \"--sort-by-date\")) {\n+\t\t\tsort_by_date = 1;\n+\t\t\tcontinue;\n+\t\t}\n \t\tusage(builtin_branch_usage);\n \t}\n \n@@ -632,7 +664,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \tif (delete)\n \t\treturn delete_branches(argc - i, argv + i, force_delete, kinds);\n \telse if (i == argc)\n-\t\tprint_ref_list(kinds, detached, verbose, abbrev);\n+\t\tprint_ref_list(kinds, detached, verbose, abbrev, sort_by_date);\n \telse if (rename && (i == argc - 1))\n \t\trename_branch(head, argv[i], force_rename);\n \telse if (rename && (i == argc - 2))\n-- \n1.5.1.rc2.2330.g2388\n"},{"id":"38201","messageId":"20070327233552.GA7186@coredump.intra.peff.net","threadId":"7436","inReplyTo":"17929.37382.984339.742025@lisa.zopyra.com","subject":"Re: Listing of branch creation time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-27T23:35:52Z","receivedAt":"2007-03-27T23:35:52Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 03:52:06PM -0600, Bill Lear wrote:\n\n> I'm sure the git developers grow tired of working with addle-brained\n> users, but I sometimes forget what the contents of a topic branch are,\n> how old it is, etc.  As to content, I can make better branch names,\n> but I think it would be useful to be able to query git as to the\n> creation time of all of my branches, perhaps sorted from newest to\n> oldest.\n\nI'm not sure you can always accurately get that information. If you have\nreflogs turned on, you can look at the oldest reflog for the that ref;\nhowever, the reflog may have been pruned. You can also try looking at\nthe commit graph, but then you need a reference branch (\"when did I\nbranch from master\"), and even that's not entirely useful. You have to\nlook at the latest merge-base, but that tells you the last time you\nmerged with master, not necessarily the first time.\n\nThat being said, something like this should work:\n\n-- >8 --\n#!/bin/sh\n\nbranch_date() {\n  git-rev-list -g --pretty=format:'%ct %cd' $1 | tail -n 1\n}\n\ngit-show-ref --heads |\n  while read sha1 branch; do\n    echo \"$branch `branch_date $branch`\"\n  done |\n  sort -k 2nr |\n  while read branch timestamp date; do\n    printf '%20s %s\\n' ${branch#refs/heads/} \"$date\"\n  done\n-- >8 --\n\nUnfortunately, there is a bug in git-rev-list; I've just posted a patch, but\nthe one-liner fix is:\n\ndiff --git a/commit.c b/commit.c\nindex 718e568..a92958c 100644\n--- a/commit.c\n+++ b/commit.c\n@@ -760,7 +760,7 @@ static void fill_person(struct interp *table, const char *msg, int len)\n \tif (msg + start == ep)\n \t\treturn;\n \n-\ttable[5].value = xstrndup(msg + start, ep - msg + start);\n+\ttable[5].value = xstrndup(msg + start, ep - (msg + start));\n \n \t/* parse tz */\n \tfor (start = ep - msg + 1; start < len && isspace(msg[start]); start++)\n\nWith that fix, the script above should hopefully produce what you want.\n\n-Peff\n"},{"id":"38213","messageId":"Pine.LNX.4.63.0703271549210.15345@qynat.qvtvafvgr.pbz","threadId":"7436","inReplyTo":"17929.45908.803852.973157@lisa.zopyra.com","subject":"Re: Listing of branch creation time?","fromName":"David Lang","fromEmail":"david.lang@digitalinsight.com","sentAt":"2007-03-27T23:51:36Z","receivedAt":"2007-03-27T23:51:36Z","isPatch":false,"sender":{"key":"david.lang@digitalinsight.com","avatar":null},"body":"On Tue, 27 Mar 2007, Bill Lear wrote:\n\n> On Tuesday, March 27, 2007 at 20:10:27 (-0400) Jeff King writes:\n>> On Tue, Mar 27, 2007 at 06:08:07PM -0600, Bill Lear wrote:\n>>\n>>> Queries that help me answer the question of \"did I merge this\n>>> branch?\", \"when did I merge it?\" (i.e., \"Can I delete this branch?\"),\n>>> along with creation times and last modified times, I think would be\n>>> helpful.\n>>\n>> I find that a nice 'gitk branch...origin' answers most of those for me\n>> (it's everything in both branches going back to the last time they\n>> merged).\n>\n> Hmm, perhaps I should learn to use gitk more, though I must admit\n> to being somewhat of an anti-GUI bigot (i.e., lazy).\n\ngiven that we had someone post a tool to the list that creates ascii-art merge \ndiagrams, I wonder if it would scratch anyone's itch to make an ascii output \nversion of gitk?\n\nthe code posted was limited to 26 merges, but it would probably be easy enough \nto do two-letter nodes (although at that point do you _really_ want it on a text \nscreen ;-)\n\nDavid Lang\n"},{"id":"38205","messageId":"17929.44659.574482.637805@lisa.zopyra.com","threadId":"7436","inReplyTo":"Pine.LNX.4.63.0703280056140.4045@wbgn013.biozentrum.uni-wuerzburg.de","subject":"Re: [PATCH] git-branch: add --sort-by-date option","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-27T23:53:23Z","receivedAt":"2007-03-27T23:53:23Z","isPatch":true,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, March 28, 2007 at 01:03:57 (+0200) Johannes Schindelin writes:\n>...\n>\tThis is only lightly tested, and I will not have time to work any \n>\tmore on this. So, if this does not what you want, you will have to \n>\tfix it yourself.\n\nWell, thank you kindly for your quick reply.  I will patch this in to\nmy git source tree, test it out and see if I can fix anything that\ncomes up.\n\n\nBill\n"},{"id":"38207","messageId":"17929.45060.6228.797279@lisa.zopyra.com","threadId":"7436","inReplyTo":"20070327233552.GA7186@coredump.intra.peff.net","subject":"Re: Listing of branch creation time?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-28T00:00:04Z","receivedAt":"2007-03-28T00:00:04Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, March 27, 2007 at 19:35:52 (-0400) Jeff King writes:\n>...\n>That being said, something like this should work:\n\nOk, thank you.  I will try this out and keep this in mind as I test\nout the patch Johannes posted.\n\n\nBill\n"},{"id":"38208","messageId":"20070328000149.GA12808@coredump.intra.peff.net","threadId":"7436","inReplyTo":"17929.45060.6228.797279@lisa.zopyra.com","subject":"Re: Listing of branch creation time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-28T00:01:49Z","receivedAt":"2007-03-28T00:01:49Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 06:00:04PM -0600, Bill Lear wrote:\n\n> Ok, thank you.  I will try this out and keep this in mind as I test\n> out the patch Johannes posted.\n\nThis is, btw, completely different than what Johannes posted. His patch\nshows you the date of the _tip_ of each of the branches. My script shows\nthe _oldest_ reflog for the branch. So it depends on whether you want\nthem in order of \"last worked on\" or \"created\" (you said \"created\", but\nI wonder if \"last worked on\" is actually more useful).\n\n-Peff\n"},{"id":"38209","messageId":"17929.45543.421196.935796@lisa.zopyra.com","threadId":"7436","inReplyTo":"20070328000149.GA12808@coredump.intra.peff.net","subject":"Re: Listing of branch creation time?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-28T00:08:07Z","receivedAt":"2007-03-28T00:08:07Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, March 27, 2007 at 20:01:49 (-0400) Jeff King writes:\n>On Tue, Mar 27, 2007 at 06:00:04PM -0600, Bill Lear wrote:\n>\n>> Ok, thank you.  I will try this out and keep this in mind as I test\n>> out the patch Johannes posted.\n>\n>This is, btw, completely different than what Johannes posted. His patch\n>shows you the date of the _tip_ of each of the branches. My script shows\n>the _oldest_ reflog for the branch. So it depends on whether you want\n>them in order of \"last worked on\" or \"created\" (you said \"created\", but\n>I wonder if \"last worked on\" is actually more useful).\n\nAh, yes, good point.  I think this all falls under the topic of branch\nmanagement, and it would be good to have a full suite of reports for\npeople with a rats' nest of branches to keep track of.  I'm up to ten\ntopic branches and plan on needing a few more soon.\n\nQueries that help me answer the question of \"did I merge this\nbranch?\", \"when did I merge it?\" (i.e., \"Can I delete this branch?\"),\nalong with creation times and last modified times, I think would be\nhelpful.\n\nThank you again.\n\n\nBill\n"},{"id":"38211","messageId":"20070328001027.GA13293@coredump.intra.peff.net","threadId":"7436","inReplyTo":"17929.45543.421196.935796@lisa.zopyra.com","subject":"Re: Listing of branch creation time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-28T00:10:27Z","receivedAt":"2007-03-28T00:10:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 06:08:07PM -0600, Bill Lear wrote:\n\n> Queries that help me answer the question of \"did I merge this\n> branch?\", \"when did I merge it?\" (i.e., \"Can I delete this branch?\"),\n> along with creation times and last modified times, I think would be\n> helpful.\n\nI find that a nice 'gitk branch...origin' answers most of those for me\n(it's everything in both branches going back to the last time they\nmerged).\n\n-Peff\n"},{"id":"38212","messageId":"17929.45908.803852.973157@lisa.zopyra.com","threadId":"7436","inReplyTo":"20070328001027.GA13293@coredump.intra.peff.net","subject":"Re: Listing of branch creation time?","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-03-28T00:14:12Z","receivedAt":"2007-03-28T00:14:12Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Tuesday, March 27, 2007 at 20:10:27 (-0400) Jeff King writes:\n>On Tue, Mar 27, 2007 at 06:08:07PM -0600, Bill Lear wrote:\n>\n>> Queries that help me answer the question of \"did I merge this\n>> branch?\", \"when did I merge it?\" (i.e., \"Can I delete this branch?\"),\n>> along with creation times and last modified times, I think would be\n>> helpful.\n>\n>I find that a nice 'gitk branch...origin' answers most of those for me\n>(it's everything in both branches going back to the last time they\n>merged).\n\nHmm, perhaps I should learn to use gitk more, though I must admit\nto being somewhat of an anti-GUI bigot (i.e., lazy).\n\n\nBill\n"},{"id":"38214","messageId":"20070328002126.GA13354@coredump.intra.peff.net","threadId":"7436","inReplyTo":"Pine.LNX.4.63.0703271549210.15345@qynat.qvtvafvgr.pbz","subject":"Re: Listing of branch creation time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-28T00:21:26Z","receivedAt":"2007-03-28T00:21:26Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 03:51:36PM -0800, David Lang wrote:\n\n> >Hmm, perhaps I should learn to use gitk more, though I must admit\n> >to being somewhat of an anti-GUI bigot (i.e., lazy).\n> \n> given that we had someone post a tool to the list that creates ascii-art \n> merge diagrams, I wonder if it would scratch anyone's itch to make an ascii \n> output version of gitk?\n\nI don't like using a GUI either, but I have to admit that the output of\ngitk is so superior that it's worth it.\n\nHowever, check out the curses line-drawing support that is in tig\nnow...it just recently has gotten good enough that I might switch to it.\n\n-Peff\n"},{"id":"38217","messageId":"Pine.LNX.4.64.0703271759510.6730@woody.linux-foundation.org","threadId":"7436","inReplyTo":"20070327233552.GA7186@coredump.intra.peff.net","subject":"Re: Listing of branch creation time?","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2007-03-28T01:06:11Z","receivedAt":"2007-03-28T01:06:11Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Tue, 27 Mar 2007, Jeff King wrote:\n>\n> You have to look at the latest merge-base, but that tells you the last \n> time you merged with master, not necessarily the first time.\n\nWell, if you know which branch it is a branch off of, don't use \nmerge-base, just do\n\n\tgit log --reverse -1 origin..branch\n\nwhich should pick up the first commit that is on that branch but haven't \nbeen merged back to the original branch.\n\nThe merge-base is the right thing to do for *merging*, but if you keep \nmerging into the branch you are developing on (to keep up-to-date), the \nabove \"what is on the branch but not in the origin\" is definitely the \nright thing to do.\n\nOf course, people already pointed out \"gitk\". And I agree. Quite often, \nit's worth the full graphical output to do\n\n\tgitk origin..branch\n\nto see the big picture. But if you want to work on the command line, the \nabove \"git log\" command line isn't really that bad to type..\n\n(Personally, if I didn't want the graphical version, I'd likely just do\n\n\tgit log origin..branch\n\nand then do '>' in the pager to get to the bottom. That way I can then \nscroll up and down if I decide I want to get a bigger picture)\n\n\t\tLinus\n"},{"id":"38218","messageId":"alpine.LFD.0.83.0703272114300.3041@xanadu.home","threadId":"7436","inReplyTo":"20070328000149.GA12808@coredump.intra.peff.net","subject":"Re: Listing of branch creation time?","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-03-28T01:25:48Z","receivedAt":"2007-03-28T01:25:48Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Tue, 27 Mar 2007, Jeff King wrote:\n\n> On Tue, Mar 27, 2007 at 06:00:04PM -0600, Bill Lear wrote:\n> \n> > Ok, thank you.  I will try this out and keep this in mind as I test\n> > out the patch Johannes posted.\n> \n> This is, btw, completely different than what Johannes posted. His patch\n> shows you the date of the _tip_ of each of the branches. My script shows\n> the _oldest_ reflog for the branch. So it depends on whether you want\n> them in order of \"last worked on\" or \"created\" (you said \"created\", but\n> I wonder if \"last worked on\" is actually more useful).\n\nI think \"last worked on\" is the only thing that makes sense.  Anything \nelse is completely ambigous, especially in the presence of forks and \nmerges.  And eventually all reflogs will have about the same age when \nthey extend past the expiration period, at which point the \"oldest \nreflog\" is not meaningful anymore.\n\nHowever Johannes' patch uses the author date for sorting.  I think \nbranches \nreally should be sorted by committer's date though.  The committer's \ndate is a much better indicator of when a given branch has been updated \nwhile the author's date might be any time in the past.\n\n\nNicolas\n"},{"id":"38219","messageId":"alpine.LFD.0.83.0703272126290.3041@xanadu.home","threadId":"7436","inReplyTo":"17929.45543.421196.935796@lisa.zopyra.com","subject":"Re: Listing of branch creation time?","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-03-28T01:29:11Z","receivedAt":"2007-03-28T01:29:11Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Tue, 27 Mar 2007, Bill Lear wrote:\n\n> Queries that help me answer the question of \"did I merge this\n> branch?\", \"when did I merge it?\" (i.e., \"Can I delete this branch?\"),\n> along with creation times and last modified times, I think would be\n> helpful.\n\nThe reflog is your friend for such questions.\n\n\nNicolas\n"},{"id":"38222","messageId":"7vd52um8d9.fsf@assigned-by-dhcp.cox.net","threadId":"7436","inReplyTo":"Pine.LNX.4.64.0703271759510.6730@woody.linux-foundation.org","subject":"Re: Listing of branch creation time?","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-03-28T02:04:18Z","receivedAt":"2007-03-28T02:04:18Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Linus Torvalds <torvalds@linux-foundation.org> writes:\n\n> On Tue, 27 Mar 2007, Jeff King wrote:\n>>\n>> You have to look at the latest merge-base, but that tells you the last \n>> time you merged with master, not necessarily the first time.\n>\n> Well, if you know which branch it is a branch off of, don't use \n> merge-base, just do\n>\n> \tgit log --reverse -1 origin..branch\n>\n> which should pick up the first commit that is on that branch but haven't \n> been merged back to the original branch.\n\nI suspect you fell into the common trap of confused interaction\nbetween --max-count and --reverse here.  This will show the\nlatest one commit on the branch that is still not in origin.\n\nSimilarly, \"git log --reverse -1 master\" is _not_ the way to\nfind the root commit of the project.\n\n> (Personally, if I didn't want the graphical version, I'd likely just do\n>\n> \tgit log origin..branch\n>\n> and then do '>' in the pager to get to the bottom. That way I can then \n> scroll up and down if I decide I want to get a bigger picture)\n\nWhat I use myself is git-topic.perl script from the 'todo'\nbranch.  It essentially is:\n\n\tfor topic\n        do\n        \tgit [short]log --no-merges master..$topic\n\tdone\n\nwith frills.\n"},{"id":"38223","messageId":"20070328025200.GA13563@coredump.intra.peff.net","threadId":"7436","inReplyTo":"Pine.LNX.4.64.0703271759510.6730@woody.linux-foundation.org","subject":"Re: Listing of branch creation time?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-03-28T02:52:00Z","receivedAt":"2007-03-28T02:52:00Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Mar 27, 2007 at 06:06:11PM -0700, Linus Torvalds wrote:\n\n> The merge-base is the right thing to do for *merging*, but if you keep \n> merging into the branch you are developing on (to keep up-to-date), the \n> above \"what is on the branch but not in the origin\" is definitely the \n> right thing to do.\n\nOf course you're right, I must have had afternoon brain impairment when\nI wrote that other message.\n\n-Peff\n"},{"id":"48376","messageId":"Pine.LNX.4.64.0707240011500.14781@racer.site","threadId":"7436","inReplyTo":"17929.44659.574482.637805@lisa.zopyra.com","subject":"[PATCH] Teach revision machinery about --no-walk","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-07-23T23:38:40Z","receivedAt":"2007-07-23T23:38:40Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThe flag \"no_walk\" is present in struct rev_info since a long time, but\nso far has been in use exclusively by \"git show\".\n\nWith this flag, you can see all your refs, ordered by date of the last\ncommit:\n\n$ git log --abbrev-commit --pretty=oneline --decorate --all --no-walk\n\nwhich is extremely helpful if you have to juggle with a lot topic\nbranches, and do not remember in which one you introduced that uber\ndebug option, or simply want to get an overview what is cooking.\n\n(Note that the \"git log\" invocation above does not output the same as\n\n $ git show --abbrev-commit --pretty=oneline --decorate --all --quiet\n\n since \"git show\" keeps the alphabetic order that \"--all\" returns the\n refs in, even if the option \"--date-order\" was passed.)\n\nFor good measure, this also adds the \"--do-walk\" option which overrides \n\"--no-walk\".\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Tue, 27 Mar 2007, Bill Lear wrote:\n\n\t> On Wednesday, March 28, 2007 at 01:03:57 (+0200) Johannes Schindelin writes:\n\t> >...\n\t> >\tThis is only lightly tested, and I will not have time to work any \n\t> >\tmore on this. So, if this does not what you want, you will have to\n\t> >\tfix it yourself.\n\t> \n\t> Well, thank you kindly for your quick reply.  I will patch this in to my \n\t> git source tree, test it out and see if I can fix anything that comes \n\t> up.\n\n\tActually, I tested this a lot in recent times, especially since I \n\tstarted to use topic branches a lot more, to keep Junio happy.\n\n\tAnd then I had an idea: Much better to let \"git log\" do the work, \n\tsince it already sorts the commits it shows by date.  There is a \n\tflag in the revision machinery, named \"no_walk\" which would tell \n\tit to not traverse all ancestors.\n\n\tSince I can make this an alias, it does not matter very much that \n\tthe command line is so long.  However, since you can use different \n\tpretty formats, this might be much more useful than the \n\t--sort-by-date option for \"git branch\".\n\n Documentation/git-rev-list.txt |    9 +++++++++\n revision.c                     |    8 ++++++++\n 2 files changed, 17 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-rev-list.txt b/Documentation/git-rev-list.txt\nindex 0430139..1c19781 100644\n--- a/Documentation/git-rev-list.txt\n+++ b/Documentation/git-rev-list.txt\n@@ -37,6 +37,7 @@ SYNOPSIS\n \t     [ \\--merge ]\n \t     [ \\--reverse ]\n \t     [ \\--walk-reflogs ]\n+\t     [ \\--no-walk ] [ \\--do-walk ]\n \t     <commit>... [ \\-- <paths>... ]\n \n DESCRIPTION\n@@ -398,6 +399,14 @@ These options are mostly targeted for packing of git repositories.\n \tOnly useful with '--objects'; print the object IDs that are not\n \tin packs.\n \n+--no-walk::\n+\n+\tOnly show the given revs, but do not traverse their ancestors.\n+\n+--do-walk::\n+\n+\tOverrides a previous --no-walk.\n+\n \n include::pretty-formats.txt[]\n \ndiff --git a/revision.c b/revision.c\nindex 00b75bc..16f35c7 100644\n--- a/revision.c\n+++ b/revision.c\n@@ -1191,6 +1191,14 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, const ch\n \t\t\t\trevs->reverse ^= 1;\n \t\t\t\tcontinue;\n \t\t\t}\n+\t\t\tif (!strcmp(arg, \"--no-walk\")) {\n+\t\t\t\trevs->no_walk = 1;\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\tif (!strcmp(arg, \"--do-walk\")) {\n+\t\t\t\trevs->no_walk = 0;\n+\t\t\t\tcontinue;\n+\t\t\t}\n \n \t\t\topts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);\n \t\t\tif (opts > 0) {\n-- \n1.5.3.rc2.31.gf7d7-dirty\n"}]}