Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jgit-dev] Retrieving parent branch name

On Sun, Feb 19, 2017 at 10:47 AM, Alaa Nassef <alan.125@xxxxxxxxx> wrote:
I'm working on a project where I create a bare repository from a remote one, and fetch only one branch. What I'm trying to find out now is the name of the parent branch (or more specifically, the commit on the parent branch where this branch was created from) to identify the commits that were done on this branch only. For example, if my repository has a RefSpec for branch featureA only, and this was created from branch development on remote from commit 123, what can I do to find out this info?

you can use git ls-remotes to find branches and the commit they currently point at in a remote repository.
Commits don't know on which branch they were created.

Git reflog tracks whenever a local branch or HEAD is moving to another commit. But reflogs can only be
accessed locally, there is no remote API to inspect them. Also reflogs may be deleted depending on the configured
expiration time.

-Matthias

Back to the top