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

Can we sync remote repository and local repository?

Jewel Francis February 10, 2015

Hi Team,

 

I can see that there is an option in source tree to check default remotes for updates. We can even set the time interval as well. This is a very good feature and it will notify the user that he/she require a pull. But my question is, whether this pull can also be done automatically?

i.e. When the remote repo is ahead of the local repo by 'n' number of commits, can we do a git fetch/git pull automatically, similar to the way we receive the notification.

 

Warm Regards,

-Jewel

2 answers

1 accepted

2 votes
Answer accepted
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.
February 10, 2015

You cannot do this in SourceTree.

Workaround: write a short script that does a git pull in the right folder and schedule it to run regularly. (Even like this, you need to manually deal with the cases when there are un-pushed local commits or uncommitted changes, because the pull will fail / manual merge will be required.)

0 votes
Seth
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.
February 10, 2015

Few git clients will support automatic pulls, since they change the user's working copy, which can be confusing at best.

What happens if git pulls an update to a file while a user has unsaved changes in their IDE? Depends on the IDE. Some will discard the unsaved changes to load the updated file, some will overwrite the pulled changes when the user saves the IDE's copy that doesn't have those, some will prompt that there is a change. I don't know of any IDE that will merge changes to a local file with unsaved changes in the IDE.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events