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:15 UTC
Message-ID
<CA+KyZp6CBJse9jRYowgkaRctuRU4mnFz3TVwkKTwkZWkjj3GTA@mail.gmail.com>
In-Reply-To
<CA+KyZp6pvqqNnOOj0ap9ekPdv9mZg2u_NQuwFgMXfwfV17SrYQ@mail.gmail.com>
I tried this:

git checkout origin/dev # now in detached head state git branch --contains "$(git rev-parse "$feature_branch")"

and I got this output: <name of feature branch>

not sure what that means

On Thu, May 7, 2020 at 4:12 PM Alexander Mills <alexander.d.mills@gmail.com> wrote:

Show 31 quoted lines
>
> 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?
>
> On Thu, May 7, 2020 at 4:08 PM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Alexander Mills <alexander.d.mills@gmail.com> writes:
> >
> > > I am looking for a command:
> > >
> > > 1>  if branch x contains branch y
> > >
> > > right now all I can find is
> > >
> > > 2> if current branch contains commit y
> > >
> > > can someone please accomplish #1 ?
> >
> > Study "git merge-base --is-ancestor" perhaps?
>
>
>
> --
> Alexander D. Mills
> New cell phone # (415)730-1805
> linkedin.com/in/alexanderdmills
-- 
Alexander D. Mills
New cell phone # (415)730-1805
linkedin.com/in/alexanderdmills
Previous: Alexander MillsNext: brian m. carlson
Message 4 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.