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

Re: Ask for feature on git

From
KKKonstantin Khomoutov <kostix@bswap.ru>
Date
Sep 4, 2024, 14:55 UTC
Message-ID
<20240904145544.xi7rez4hvbfcx57l@carbon>
In-Reply-To
<CAEO06GKzQTfm9z8ODCAYdHsWwgfHau0kuFA7WFkVqkPHbsm_1g@mail.gmail.com>
On Wed, Sep 04, 2024 at 03:59:33PM +0200, Loredana Tralli wrote:
[...]
> and I'd like to know if there is a command through bash to check
> directly "you created branch test from branch release".

This is quite possible: Git has a command, `git merge-base`, which can be used to figure out the relation between two branches you're interested in. In particular, a call

  $ git merge-base --fork-point test release

should print the SHA-1 name of the last commit both branches share with each other (before their histories have diverged) and exits with status code 0. Otherwise ("test" was not forked off "release") the command would print nothing and exit with status code 1.

I would suggest to read [1] to get better understanding of what it does.
 1. https://www.git-scm.com/docs/git-merge-base
Previous: Loredana Tralli
Message 5 of 5 in “Ask for feature on git”
  1. Loredana TralliSep 3, 2024
  2. Simon RichterSep 3, 2024
  3. Konstantin KhomoutovSep 3, 2024
  4. Loredana TralliSep 4, 2024
  5. Konstantin KhomoutovSep 4, 2024

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.