git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alexander Mills <alexander.d.mills@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>,
	Alexander Mills <alexander.d.mills@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: check if one branch contains another branch
Date: Thu, 7 May 2020 16:28:40 -0700	[thread overview]
Message-ID: <CA+KyZp4keGp8j0rzCtr0fEogZqkKwTNLvRBZ2QOUzjStP+V2uA@mail.gmail.com> (raw)
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:
>
> 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

  reply	other threads:[~2020-05-07 23:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 22:59 check if one branch contains another branch Alexander Mills
2020-05-07 23:08 ` Junio C Hamano
2020-05-07 23:12   ` Alexander Mills
2020-05-07 23:15     ` Alexander Mills
2020-05-07 23:24     ` brian m. carlson
2020-05-07 23:28       ` Alexander Mills [this message]
2020-05-07 23:47         ` brian m. carlson
2020-05-07 23:31 ` Randall S. Becker
2020-05-07 23:37   ` Alexander Mills
2020-05-07 23:41     ` Junio C Hamano
2020-05-08  1:01     ` Alexander Mills
2020-05-08 12:07       ` Randall S. Becker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CA+KyZp4keGp8j0rzCtr0fEogZqkKwTNLvRBZ2QOUzjStP+V2uA@mail.gmail.com \
    --to=alexander.d.mills@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).