GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Add git merge-base command into GitPython · Issue #169 · gitpython-developers/GitPython

Add git merge-base command into GitPython #169

New issue
Copy link
New issue
Copy link
Closed
Closed
Add git merge-base command into GitPython#169
Copy link
Assignees
Byron
Labels
acknowledged
Milestone
v0.3.6 - Features

Description

@jwir3
jwir3
opened on Jun 30, 2014
Issue body actions

It would be nice if there was a way in the GitPython API to do the following native git command:

git merge-base <commit 1> <commit 2>

For example, it would be nice to be able to perform the following:

from git import *

repo = Repo('/path/to/repo')
base = repo.find_last_common_ancestor('de1f33', '78dd34')
print(base)

The expected output, assuming the least common ancestor of 'de1f33' and '78dd34' was '6ff871', (obviously all of these commits have fictional SHAs) would be:

<git.Commit "6ff871652e0f3b9fa991bbd9b42e520f91723436e">

Activity

  1. Byron
    added this to the v0.3.6 - Features milestone on Nov 19, 2014
  2. ereOn commented on Jan 8, 2015

    @ereOn
    ereOn
    on Jan 8, 2015
    More actions

    Note that the merge-base command does not take only two commits but any number of commits so the implemented solution should offer that possibility as well.

  3. Byron
    self-assigned this
    on Jan 13, 2015
  4. Byron
    added
    acknowledged
    on Jan 13, 2015
  5. Byron
    closed this as completedin e973e6fon Jan 13, 2015
  6. Byron commented on Jan 13, 2015

    @Byron
    Byron
    on Jan 13, 2015
    Member
    More actions

    Repo.merge_base() was implemented, including a rather straightforward test-case.
    All the requested are supported, after all, I am just calling the cgit implementation and interpret its return values.

    Reacted by Pragy Agarwal
  7. Byron commented on Jan 13, 2015

    @Byron
    Byron
    on Jan 13, 2015
    Member
    More actions

    You can watch the development video on youtube

  8. sonicfly commented on Feb 4, 2015

    @sonicfly
    sonicfly
    on Feb 4, 2015
    More actions

    This implementation doesn't support "--is-ancestor" flag very well, it returns empty list for both 0 and 1 status code case.

  9. Byron commented on Feb 5, 2015

    @Byron
    Byron
    on Feb 5, 2015
    Member
    More actions

    Can you please open a new issue with some information about the version of GitPython and python you are using, along with how I can reproduce the issue ?
    Thanks a lot !

  10. lahirug commented on Dec 2, 2015

    @lahirug
    lahirug
    on Dec 2, 2015
    More actions

    Does this support getting the common ancestor commit of two given branches ?
    ex: git merge-base origin/release/1.30 origin/release/1.31
    639ea92cd1c57f056e9e1a1a237fdef22533f53

    Reacted by Anshuman Goel and Nasif Imtiaz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @Byron
    Byron

Labels

acknowledged

Type

No type

Projects

No projects

    Milestone

    • v0.3.6 - Features

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.