Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » JGit(Commit from where branch is created)
JGit [message #1106470] Wed, 11 September 2013 06:22 Go to next message
Ajay Gour is currently offline Ajay Gour
Messages: 5
Registered: September 2013
Junior Member
Using JGit library, is there a way to figure out from which commit a branch is created?

Lets say, i have below mentioned structure - A, B, C, D commits are made in master branch. From B, another branch called branch-A is created and E & F commits are made in this branch.

A -> B -> C -> D (master)
.......|
.......|--> E -> F (branch-A)

Given the example above, if i am seeing the history of branch-A, i would like it to include only E and F commits (and nothing else before first revision in branch).

Is it possible using JGit?
Re: JGit [message #1142936 is a reply to message #1106470] Thu, 17 October 2013 23:37 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias Sohn
Messages: 594
Registered: July 2009
Senior Member
A git branch is just a pointer to a commit, so it doesn't know where it was created.
You may use the reflog of the respective branch to trace back operations which
moved the branch pointer.

Use the org.eclipse.jgit.api.ReflogCommand to access reflogs.
Re: JGit [message #1143527 is a reply to message #1142936] Fri, 18 October 2013 08:44 Go to previous message
Ajay Gour is currently offline Ajay Gour
Messages: 5
Registered: September 2013
Junior Member
Thanks Matthias for the response.

I realized Git doesn't store that information (like SVN which stores "copy path") so we changed our approach. As for reflog usage, i dont think that would be feasible as GIT keeps the ref logs for limited time period and we look into entire history of a project in repository.
Previous Topic:merge all branches
Next Topic:Download old versions of EGit - links broken
Goto Forum:
  


Current Time: Thu Oct 30 15:22:37 GMT 2014

Powered by FUDForum. Page generated in 0.07984 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software