Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Sourcetree - Refresh Remote Status doesn't work with Stash / Git, for deleted branches

Alex Zoro August 4, 2014

Hi,

I've been using sourcetree for some time now, and it's great.

There is one issue that is a constant headache when managing branches though: sourcetree does not correctly update the remote branch statuses, even if you select "Refresh Remote Status".

The setup we are using is with a remote Git repository running on Stash, connecting over a VPN.

Steps to reproduce:

- create a branch locally

- push to origin

- pull on another machine (or machines)

- delete the origin branch on any machine (lets call this machine 'A')

- select "Refresh Remote Status" on any other machine (anything but 'A')

- observe that the deleted branch does not disappear from the list of branches on the remote repo

Subsequently, if you delete the remote branch (from any machine other than 'A')

- observe these errors

error: unable to delete '<branch>': remote ref does not exist

error: failed to push some refs to '<repo>'

This is an issue for me both in the latest Mac client (v 1.9.7) and the latest Windows client (v 1.5.2.0), and for my colleagues who see the same issue.

I note that searching 'answers' throws up a number of discussions of similar issues with refreshing remote status, at least one of which refers to this exact problem in the comments:

https://answers.atlassian.com/questions/237303/auto-refresh-of-remote-status-in-sourcetree-not-working

https://answers.atlassian.com/questions/214369/how-do-i-see-remote-activity-refresh-remote-status-doesn-t-seem-to-do-anything

https://answers.atlassian.com/questions/47459/please-make-sourcetree-automatically-refresh-the-remote-status-on-opening-a-repo

In particular the comments from Piotr Hlawski and Cory Simmons in the first link suggest I am not the only person seeing this problem, and that it has been present for a while.

Can you confirm that this is a known issue ?

Thanks !

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Alex Zoro August 10, 2014

It turns out that this is not a bug, it's by design.

I still don't feel the manual 'Refresh Remote Status' option is particuarly clear to someone coming to this as a new user however, as I discuss in the comments here:

https://jira.atlassian.com/browse/SRCTREE-2604

0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2014

I tested the following now:

  1. Delete a branch on the server.
  2. Repository->Refresh Remote Status: branch is still there under the origin node.
  3. Fetch (no prune): branch is still there under the origin node.
  4. Fetch with prune: branch is still there under the origin node.

This looks like a bug. You can report it here. I will upvote it if you paste the link here. :)

Alex Zoro August 4, 2014
0 votes
Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2014

[Assuming that "Refresh Remote Status" above means Tools/Options/Check default remotes for updates every x minutes.]

The background checking of remotes uses the fetch command, which by default does not change your refs other than adding new ones. If you press the Fetch button, you can see an option in the dialog called "Prune tracking branches no longer present on remote(s)", which adds the --prune switch to the fetch command. This will remove the deleted branches from the list.

I guess the reason for the background fetch to not use this switch is that this is the safe option. (e.g. if someone accidentally deletes the branch on the server, it can be re-pushed form the clients, but only if it still exists there.)

Alex Zoro August 4, 2014

Hi Balazs, no, "Refresh Remote Status" in my question refers to explicitly selecting "Repository->Refresh Remote Status" from the menu.

Also, I don't want to prune any local branches if a remote branch has been deleted, as you note, that's not a 'safe' operation.

I am just interested in knowing the status of the remote branches (display them if they exist, do not display if they no longer exist!!).

Balázs Szakmáry
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 4, 2014

This does the same as the "every x minutes" option, but only once.

TAGS
AUG Leaders

Atlassian Community Events