git/list[1] front-page[2] threads[3] people[4] search[5] about
 

ANNOUNCE git-what-branch (was Re: Find out on which branch a commit was originally made)

From
SRSeth Robertson <in-gitvger@baka.org>
Date
Sep 22, 2010, 16:35 UTC
Message-ID
<201009221635.o8MGZnLD024629@no.baka.org>
In-Reply-To
<4C981475.10404@gmail.com>
In message <4C981475.10404@gmail.com>, Artur Skawina writes:
    $ time git-what-branch 1f9c381fa3e0b9b9042e310c69df87eaf9b46ea4
    1f9c381fa3e0b9b9042e310c69df87eaf9b46ea4 first merged onto v2.6.32.n using the following minimal path:
      v2.6.12-rc3-450-g1f9c381 merged up at v2.6.12-rc4-39-gad34ea2 (Fri May 20 22:27:44 2005)
      v2.6.12-rc4-39-gad34ea2 merged up at v2.6.12-rc3-590-gbfd4bda (Thu May  5 14:59:37 2005)
      v2.6.12-rc3-590-gbfd4bda merged up at v2.6.12-rc3-461-g84e48b6 (Wed May  4 00:27:24 2005)
      v2.6.12-rc3-461-g84e48b6 is on v2.6.32.n
    18m29.771s user   0m29.681s system   18m4.897s elapsed   105.03% CPU

I found two minor bugs in my script which caused it to return something other than the most optimal path in all cases. I then got crazy and added a --date-order and --topo-order -- the former orders paths by commit date and the latter orders paths by the number of merges that took place (and then by commit date) and then path summarization if multiple branches were obtained through the same path.

    Results are similar, that one extra merge i'll have to take a look at
    later, but the cost difference...

As we discussed privately, the cost difference is because instead of looking at just one branch, it is looking at 150+ branches. If you use --reference-branch to specify the one branch you are looking at, it takes a much more reasonable 15-20 seconds. Likewise if you select a commit more recent than 2005, the number of branches that it could apply to goes down and the command runs faster.

Also in my most recent version I was able to find an even shorter path (two merges to master).

I have cleaned everything up and made a formal release out of it.
It is available at:  http://github.com/SethRobertson/git-what-branch
					-Seth Robertson
Previous: Artur SkawinaNext: Artur Skawina
Message 23 of 33 in “Find out on which branch a commit was originally made”
  1. Stefan HallerSep 18, 2010
  2. Ævar Arnfjörð BjarmasonSep 18, 2010
  3. Ævar Arnfjörð BjarmasonSep 18, 2010
  4. Tor ArntsenSep 18, 2010
  5. Stefan HallerSep 18, 2010
  6. Artur SkawinaSep 18, 2010
  7. Stefan HallerSep 19, 2010
  8. Clemens BuchacherSep 19, 2010
  9. Artur SkawinaSep 19, 2010
  10. Stefan HallerSep 19, 2010
  11. Artur SkawinaSep 19, 2010
  12. Robin RosenbergSep 19, 2010
  13. Seth RobertsonSep 19, 2010
  14. Artur SkawinaSep 19, 2010
  15. Seth RobertsonSep 19, 2010
  16. Artur SkawinaSep 20, 2010
  17. Seth RobertsonSep 20, 2010
  18. Stefan HallerSep 20, 2010
  19. Artur SkawinaSep 20, 2010
  20. Artur SkawinaSep 20, 2010
  21. Seth RobertsonSep 21, 2010
  22. Artur SkawinaSep 21, 2010
  23. ANNOUNCE git-what-branch (was Re: Find out on which branch a commit was originally made)Seth Robertson, Sep 22, 2010
  24. Artur SkawinaSep 22, 2010
  25. Seth RobertsonSep 22, 2010
  26. Stephen BashSep 23, 2010
  27. Ævar Arnfjörð BjarmasonSep 23, 2010
  28. Artur SkawinaSep 23, 2010
  29. Artur SkawinaSep 24, 2010
  30. Seth RobertsonSep 24, 2010
  31. Seth RobertsonSep 23, 2010
  32. Stefan HallerSep 20, 2010
  33. Bryan DrewerySep 24, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.