Github merge on SourceTree

I have given myself a headache trying to figure out exactly how to pull changes from a forked repo. I have made no changes to the child repo, so I would assume there is no merge? I am quite new to both git and sourcetree, but would rather do things through the UI if possible.

It looks like to get the fork, I must create the upstream remote (which I have done successfully), then fetch / pull (not entirely sure I have done this right, I just right click on upstream remote and 'fetch from upstream'.

Assuming this is fine (which I think it is), how do I merge any files that have been modified on the parent repo? Will fetch already get these for me if I have not made changes? What can I use to do this? Any links to details on this would be great as unfortunately, as nice as the tool is, the documention seems to be lacking.

Secondly, once I have my files merged locally, it does not look like I am able to push my changes to the child (my) repo using the regular commit. They just dont appear in the commit dialog... I think I have pretty much clicked everything except the correct button.

Any guidance appreciated. I assume this stuff is pretty simple...

1 answer

This widget could not be displayed.

Fetch actually just downloads the changes from the remote, but then just stores them in the local records but only pointed to by the remote branches. So after you fetch (which actually, SourceTree does for you every 10 minutes in the standard configuration, see Preferences option 'Check defaults remotes every X minutes'), you'll only see the remote branches move in the log (the grey logos).

To actually bring those changes into your local branch, you have to use Pull. By default the Pull dialog will try to pull from whatever remote branch your local branch is tracking (which will usually be the one it was checked out from, probably the original clone if you haven't done anything else). But you can select another remote (your fork) and pull from there if you want too.

If there are no changes in your local branch then there won't actually be a merge, it will just 'Fast forward' your local branch to the same point as the remote branch. If there is a divergence then Git will try to automatically merge them. Only if that fails will you have to resolve the merge conflicts yourself, and then commit the merge. So the chances are, it sounds like you won't have anything to do manually here in your case.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...

861 views 2 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