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

Re: check if one branch contains another branch

From
Alexander Mills <alexander.d.mills@gmail.com>
Date
May 7, 2020, 23:28 UTC
Message-ID
<CA+KyZp4keGp8j0rzCtr0fEogZqkKwTNLvRBZ2QOUzjStP+V2uA@mail.gmail.com>
In-Reply-To
<20200507232448.GB7234@camp.crustytoothpaste.net>
Thanks will check that out.
This command does not seem to work :(
> git branch --contains branchB
I do this:

git checkout branchB git commit --allow-empty -am 'empty commit message' git checkout dev git branch --contains branchB ==> exit code 0 git branch --contains $(git rev-parse branchB) ==> exit code 0

this seems like a bug or something. Why wouldn't it exit with 1, since it obviously does not contain that commit? This kinda sucks tbh :(

On Thu, May 7, 2020 at 4:25 PM brian m. carlson <sandals@crustytoothpaste.net> wrote:

Show 19 quoted lines
>
> On 2020-05-07 at 23:12:09, Alexander Mills wrote:
> > so it would be:
> >
> > feature_branch='my_branch'  # the branch that I want to ensure is
> > completely merged into origin/dev
> > git merge-base  origin/dev --is-ancestor "$feature_branch"
> >
> > that won't work?  since git merge-base only works with current branch?
>
> No, that's not the case.  You can write this:
>
>   git merge-base --is-ancestor $feature_branch origin/dev
>
> This works from any branch and exits 0 if the branch is in origin/dev
> and 1 if it is not.  In neither case does it print anything.
> --
> brian m. carlson: Houston, Texas, US
> OpenPGP: https://keybase.io/bk2204
-- 
Alexander D. Mills
New cell phone # (415)730-1805
linkedin.com/in/alexanderdmills
Previous: brian m. carlsonNext: brian m. carlson
Message 6 of 12 in “check if one branch contains another branch”
  1. Alexander MillsMay 7, 2020
  2. Junio C HamanoMay 7, 2020
  3. Alexander MillsMay 7, 2020
  4. Alexander MillsMay 7, 2020
  5. brian m. carlsonMay 7, 2020
  6. Alexander MillsMay 7, 2020
  7. brian m. carlsonMay 7, 2020
  8. Randall S. BeckerMay 7, 2020
  9. Alexander MillsMay 7, 2020
  10. Junio C HamanoMay 7, 2020
  11. Alexander MillsMay 8, 2020
  12. Randall S. BeckerMay 8, 2020

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.