Please make SourceTree automatically refresh the remote status on opening a repo!
Asked by Martin Baker:

When opening a repo where I know that the local is behind the remote or vice versa, it would be good for the commit list to get automatically updated rather than having to manually refresh.


Answers:
author: stevestreeting
body: SourceTree refreshes the remote status (via 'git fetch', or 'hg incoming') only as frequently as specified in Preferences ('Check default remotes for updates ever X minutes), in order to avoid hitting remotes too often. Whenever the information is requested, which includes when the window opens, SourceTree compares when it last checked the remotes for this repo with the current time, and doesn't do it unless that time has passed. All repositories which are open or visible in the bookmarks window will get periodically checked at that frequency too even if they're just left open.

If you want SourceTree to refresh faster you can reduce this time period, or use the 'Refresh Remote Status' option to trigger the process earlier.

comments: author: Kevin
body: I know this is an old thread, but I wanted to add something to it. I trusted that the "Check default remotes for updates every X minutes" would clear out delete remote branches automatically. However, much to my surprise and my team, people were pushing up delete branches because they trusted this fact.

I suggest that you add a checkbox in the Preferences to add the PRUNE option to the fetch (git fetch -p) so users can truly appreciate the automatic refresh and not have to worry about having to fetch manually.


author: stevestreeting
body: The prune option is available in an explicit fetch from the toolbar, we thought that destructive operations shouldn't be done silently in the background.

I don't know what you mean by 'pushing up deleted branches' though. Remote branches that you have via fetch are never pushed, only local branches are, and even then only the ones you check when you click 'Push'. So not pruning deleted remote branches should never cause branches to be re-created in the remote again.


author: Kevin
body: Hi Steve, thanks for the quick reply. I found the prune option from the toolbar fetch, but I'm just suggesting that an option be added to the Preferences that includes PRUNE if the user chooses so. Would it be bad to refresh the list of remote branches (and remove ones that don't exist) frequently? What are we really destroying but a list of remote branches?

When I mentioned push up deleted branches, what happened to us is that a user had an old list of remote branches and many of these branches were local as well. When the PUSH window pops up, it automatically selects all branches to push, but if a remote branch was previously deleted, it would be pushed up and created remotely again.

Maybe a better solution would be to not automatically select all local branches when clicking 'Push'. ?


author: Leonard Br?nings
body: Hi Steve,

has this feature been deactivated in the recent versions (0.9.x-0.9.4)? I can't find the option to enable remote refresh or the interval for it in the general preferences. The only mention I can find is in the individual repo settings "Refresh remote status in the background (if enabled in global options)" and in the Actions menu "Refresh remote status Shif+Alt+R" which does nothing. I even checked the user.config file and there is no key containing the word "remote".


author: Leonard Br?nings
body: Hi Steve,

has this feature been deactivated in the recent versions (0.9.x-0.9.4)? I can't find the option to enable remote refresh or the interval for it in the general preferences. The only mention I can find is in the individual repo settings "Refresh remote status in the background (if enabled in global options)" and in the Actions menu "Refresh remote status Shif+Alt+R" which does nothing. I even checked the user.config file and there is no key containing the word "remote".


author: Leonard Br?nings
body: Hi Steve,

has this feature been deactivated in the recent versions (0.9.x-0.9.4)? I can't find the option to enable remote refresh or the interval for it in the general preferences. The only mention I can find is in the individual repo settings "Refresh remote status in the background (if enabled in global options)" and in the Actions menu "Refresh remote status Shif+Alt+R" which does nothing. I even checked the user.config file and there is no key containing the word "remote".


author: stevestreeting
body: @Leonard - it didn't exist in the Windows version yet; Windows is catching up with the Mac version. However I added the feature just this week ready for the imminent 1.0 release, so sit tight, you'll have it soon. :)

(this thread is from 2012 when only the Mac version existed)


author: Leonard Br?nings
body: @Steve - thanks for the quick reply looking forward to the 1.0 then.


author: Kevin
body: I know this is an old thread, but I wanted to add something to it. I trusted that the "Check default remotes for updates every X minutes" would clear out delete remote branches automatically. However, much to my surprise and my team, people were pushing up delete branches because they trusted this fact.

I suggest that you add a checkbox in the Preferences to add the PRUNE option to the fetch (git fetch -p) so users can truly appreciate the automatic refresh and not have to worry about having to fetch manually.

comments: author: Morgan Kita
body: Yes this honestly a super annoying issue. We just started using it at our company, and someone just ran into this. They had no idea the branch was deleted remotely, but since we had used a force push to support squashing on pull requests, he saw he was behind and ahead. However, the branch was gone on the server, and he had no idea whether he had local changes or not.The workflow cost of that is already higher than someone losing remotes from a listing which no longer point to anything. Honestly as long as it doesn't touch local branches, who are we protecting with such things? At the very least a general checkbox option somewhere, say under the repository source tree settings would do the trick.All this is accomplishing is punishing people from Git's robust configuration. The norm would be to remove those extra remote entries in system designed to remote configurability, NOT to protect them.


author: Stefan Bauer
body: I also want to add something: Is it possible (like all other git clients do), to call this "refresh remote status" when window gets active and/or i click on a branch? I like sourcetree very much, but it is totally annoying, that you change something.. there are no external changes, commit, push, and then error occurs, because THEN sourcetree throws notification that NOW there are changes - sorry, but this is little bit too late :)

comments: author: stevestreeting
body: 'All other git clients' don't actually do this (some do). Some people, me included, don't want the extra overhead of a fetch before every sigle push - after all if you're working on a feature branch but the rest of the team is working on other stuff, if things are busy it's an extra delay you don't need on push in a lot of cases. Better to let the background fetch do it for you most of the time and just deal with the exceptions if they happen, IMO.

We may add a Sync option for people who prefer the more heavyweight option later though.