Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » JGit method to retrieve "Your branch is ahead of 'origin/master' by 2 commits."?(I'd like to show the info that git status returns regarding commits behind the origin repo.)
JGit method to retrieve "Your branch is ahead of 'origin/master' by 2 commits."? [message #1708587] Thu, 17 September 2015 17:17 Go to next message
Sam Hokin is currently offline Sam HokinFriend
Messages: 1
Registered: September 2015
Junior Member
I've got a little code in the footer on a site that shows the status of the repo that the site is running off on, using git.status() and git.getRepository() and subsidiary methods from the JGit package. However I can't figure out how to get a particular piece of info that command-line git returns, like this:
$ git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean
$

Specifically, i'd like the number of commits ahead of origin/master, 2 in this case. Any help or pointers would be appreciated!
Re: JGit method to retrieve "Your branch is ahead of 'origin/master' by 2 commits.&quot [message #1708637 is a reply to message #1708587] Fri, 18 September 2015 09:00 Go to previous message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
Sam,

some time ago I answered a similar question on stackoverflow:

http://stackoverflow.com/questions/23605838/determine-number-of-commit-ahead-and-behind-using-jgit

HTH
Rüdiger

On 17.09.2015 21:01, Sam Hokin wrote:
> I've got a little code in the footer on a site that shows the status of
> the repo that the site is running off on, using git.status() and
> git.getRepository() and subsidiary methods from the JGit package.
> However I can't figure out how to get a particular piece of info that
> command-line git returns, like this:
>
> $ git status
> On branch master
> Your branch is ahead of 'origin/master' by 2 commits.
> (use "git push" to publish your local commits)
> nothing to commit, working directory clean
> $
>
> Specifically, i'd like the number of commits ahead of origin/master, 2
> in this case. Any help or pointers would be appreciated!
Previous Topic:Branch switching: closed projects
Next Topic:Git Conflict issue
Goto Forum:
  


Current Time: Thu Mar 28 08:51:08 GMT 2024

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

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

Back to the top