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

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

From
ASArtur Skawina <art.08.09@gmail.com>
Date
Sep 22, 2010, 20:27 UTC
Message-ID
<4C9A66AF.5000302@gmail.com>
In-Reply-To
<201009221635.o8MGZnLD024629@no.baka.org>
On 09/22/10 18:35, Seth Robertson wrote:
> 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

This started in a thread about locating dead topic branches, but what you want is something slightly different, hence the confusion. AFAIUI it now, your case is basically this: you have several independently developed topic (or side-) branches, which are periodically merged into a master branch, the side branches themselves are also merging 'master' to receive changes happening elsewhere. So the graph could look like this:

 m-> m -> m -> m -> m -> m -> m ->   master
  \        \       /         /
   b -> b -> b -> b -> b -> b ->    side-branch#1
Ditto for the other n side-branches. 

What you're asking for is: given commit C and a list of several side branches, tell me where (ie on which branch) this commit originated.

Two things make the above trivial history a bit more complicated.
A) one side-branch can merge another, and build on top of changes that
   are not yet available on 'master'; the result can then appear in master
   via either one or both paths. This is why showing when and how a change
   became visible on every side branch can be interesting.
B) when a side branch does not contain any new changes, but is made uptodate
   wrt master, the resulting history could end up like this:
 m-> m -> m -> m -> m -> m -> m ->   master
  \           /      \       /
   b -> b -> b        c ->  c ->    side-branch#1
    
   What happened was -- git "optimized" the simple merge away, turning it
   into a fast-forward, saving one merge commit, but loosing the link
   connecting the 'c' and 'b' parts of 'side-branch#1'.   

Do you (anybody) happen to know a public repo, w/ history as above, ie w/ more then one long-lived branch that has seen some fast-forwards? I wonder how reliable recovering the missing link would be...

And there's no reason why this operation should take ~20 minutes, even for the randomly chosen, but real, worst case. But finding a good repo to test w/ would take longer than writing the code...

artur
Previous: Seth RobertsonNext: Seth Robertson
Message 24 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.