This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 244707

Summary: Automatically pull branch
Product: versioncontrol Reporter: pinus <pinus>
Component: GitAssignee: Ondrej Vrabec <ovrabec>
Status: RESOLVED FIXED    
Severity: normal CC: git
Priority: P3    
Version: 8.0   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 245078    
Bug Blocks:    

Description pinus 2014-05-24 09:08:52 UTC
I want to be able to tag a branch to automatically being pulled. Netbeans should keep the tagged branch always up to date with the remote branch.

This is helpful if you have for example a remote master branch you have to merge into. You develop in a feature branch but you have to merge into the master branch later. Keeping up to date with the remote branch is a bit complicated today. On the command line you would need:
git stash
git checkout master
git pull
git checkout your working branch
git stash-unapply
With the UI it is even more complicated because stashing is only supported via export. 

This feature helps to avoid merge issues for those who are used to subversion where the remote branch is implicitly up to date because you fetched the server. I have several branches where I have to do reviews and it is annoying to keep them up to date.
Comment 1 Ondrej Vrabec 2014-05-25 15:32:06 UTC
Do you mean something like:
1) stay on the feature branch and do not leave it
2) automatically call git fetch
3) and then something like "git reset origin/master" called on master? In other words move master branch to the same commit as origin/master, of course only if it does not contain any local commit.
Comment 2 pinus 2014-05-25 19:15:43 UTC
Yes, except that I want that feature not only for the master branch. I want to be able to follow several branches at latest commit. And you are right, the reset is probably better than a pull. This is very handy if you follow (review) several branches.
Comment 3 Ondrej Vrabec 2014-06-13 12:31:41 UTC
i would like to have this split into two steps (two issues):
step #1: nothing would be automatic, an action will be enabled on e.g. "master" [Sync with origin/master] that will only move master on top of origin/master - of course only when merge is not needed: so you will still have to:
1) git fetch/pull
2) then occasionally do "Sync with origin/XYZ" from the popup in the repository browser
It should still save you a lot of time, but will be faster and easier to implement than:
step #2: do automatic fetch and do step #1 without user manually calling it. There are several questions i need to evaluate (working network connetions, corrrect credentials, run not very often etc.)

So i think i will be able to do step #1 for the current NB release.
Comment 4 pinus 2014-06-14 10:53:14 UTC
This sounds like a very good idea, since you might work off line and then you will always get failures. That might be possible to handle but the manual version seems smarter.
From the users perspective it also makes sense. You press a button to fetch new stuff. You expect updates, and you expect failures, e.g. when merges are required. If everything would be automatic you would get a pop-up while you are doing something else, not expecting this pop-up/problem.
You don't need to do it occasionally, you can use the fetch as a trigger. You only need to flag the branches you want to sync and sync after fetch.
Comment 5 Ondrej Vrabec 2014-06-23 10:03:08 UTC
Let's agree on this:
- in the repository browser open the popup menu on a local branch
- select/unselect the option "[x] Automatically Synchronize with "origin/master"
- when selected then the local branch will be synced after a fetch/pull automatically.

fix: http://hg.netbeans.org/core-main/rev/e15f18571505
Comment 6 Quality Engineering 2014-06-24 02:41:24 UTC
Integrated into 'main-silver', will be available in build *201406240001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/e15f18571505
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #244707 - Automatically pull branch
Automatically sync tracking branches after a fetch or pull