Can we sync remote repository and local repository?

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

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.)

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 Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

241 views 0 3
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot