Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Indicator that upstream branch has updated?
Indicator that upstream branch has updated? [message #937097] Mon, 08 October 2012 16:58 Go to next message
D Z is currently offline D ZFriend
Messages: 1
Registered: October 2012
Junior Member

I've tried searching, but I can't find an answer to this question:

Does EGit indicate which projects' repos have upstream updates to the branch you currently have checked out? In other words, if my local git repo is a clone from GitHub (and so I have tracking branches), will I get an indicator that tells me visually that GitHub has been updated and that I need to fetch if I want to be in sync?

Sorry for being clueless -- All I really want is easy in-eclipse notifications, and I'm wondering if EGit can help me or not. Thanks for any reply.

-- DZ
Re: Indicator that upstream branch has updated? [message #937229 is a reply to message #937097] Mon, 08 October 2012 20:09 Go to previous messageGo to next message
R Shapiro is currently offline R ShapiroFriend
Messages: 386
Registered: June 2011
Senior Member
EGit provides a visual decoration if the active branch is behind and/or ahead of the branch or reference it's tracking (it can of course be both behind and ahead simultaneously). The decoration is an up-arrow+count for the number of commits ahead, and down-arrow+count for the number of commits behind. This works for all tracking branches, whether what's being tracked is a remote-reference or a local branch (the status decoration for local branch tracking is relatively new).

In that way it behaves like "git status" on the command-line. But also like "git status", when tracking a remote-reference it relies on the local state of that reference. To ensure that the remote-reference is current with the remote repository you must do a fetch. As far as I know that's true both in Git and EGit. Keep in mind that fetch does not do anything with your working tree or index. All it does is copy commits and update remote-references.

So the short answer to your question is: do a fetch and EGit will update the decorations accordingly.

If you're looking for the Git equivalent of 'hg in' in Mercurial or 'svn status -u' in Subversion, I don't think it exists in Git (or EGit). It isn't necessary, given Git's remote-reference concept, which neither SVN nor Mercurial has.

Re: Indicator that upstream branch has updated? [message #937949 is a reply to message #937229] Tue, 09 October 2012 12:03 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1035
Registered: July 2009
Senior Member
The other prerequisite of this decoration is that the currently checked out branch needs to track another branch [1]. This tracking relationship is established automatically if you select a branch and click "Create Branch...", the dialog which comes up allows to choose the branch to track in case there are multiple branches pointing to the same commit and to configure the merge strategy.

Re: Indicator that upstream branch has updated? [message #1772180 is a reply to message #937949] Wed, 06 September 2017 11:48 Go to previous messageGo to next message
Francisco Osorio is currently offline Francisco OsorioFriend
Messages: 4
Registered: December 2016
Junior Member
Hi Matthias,

The decorator only is shown for the currently active branch. I think it would be beneficial to show the decorator for all local branches, so the user gets an overview of the state of all his branches after a fetch. This decorator could go into the Git Repositories view, under local branches. Do you think this would be a good idea? Do you see any problems with it? Do you know if there is a request open for this? I could contribute this if you agree to implement it.

Re: Indicator that upstream branch has updated? [message #1772195 is a reply to message #1772180] Wed, 06 September 2017 13:47 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 82
Registered: August 2016
Yes, that sounds nice, and no, AFAIK, there is no existing request for it. There is a related report from 2015 about showing this also for submodules.

Showing this in the repositories view for all local branches that do track a remote branch is a good idea. If you could contribute code for this, that'd be great.

This may need a bit of caching. Computing the BranchTrackingStatus is not for free, and spending lots of time inside the decorator in a RevWalk to compute this info should be avoided as much as possible.
Previous Topic:Resolve conflicts with egit: Files marked as untracked in the Unestaged Changes
Next Topic:How to enable Eclipse tracing in EGit Tests
Goto Forum:

Current Time: Tue Oct 23 08:18:46 GMT 2018

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

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

Back to the top