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

Re: Determining update/merge/current state of a workspace

From
brian m. carlson <sandals@crustytoothpaste.net>
Date
Feb 3, 2014, 00:50 UTC
Message-ID
<20140203005029.GF635004@vauxhall.crustytoothpaste.net>
In-Reply-To
<20140202230456.GA56790@gmail.com>
On Sun, Feb 02, 2014 at 03:04:59PM -0800, David Aguilar wrote:
Show 6 quoted lines
> I think you're looking for "git merge-base".
> 
> If you do `git merge-base HEAD origin/master`
> and its result is equal to `git rev-parse HEAD`
> then you know that master is an ancestor of origin/master
> and can be trivially fast-forwarded to origin/master.

In newer versions of git (1.8.0+), you can use "git merge-base --is-ancestor" for this instead. The commit message for 5907cda implies that it is more efficient than the old way.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187
Previous: David Aguilar
Message 4 of 4 in “Determining update/merge/current state of a workspace”
  1. Stephen LeakeFeb 2, 2014
  2. Jeff KingFeb 2, 2014
  3. David AguilarFeb 2, 2014
  4. brian m. carlsonFeb 3, 2014

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.