Will pull only merge the changes to local repository?

I am new to Source tree and Git. I am trying to understand what is the difference between Git and SVN. Someone told me that Git will take a full snapshot of the whole project instead of just for the increment files. So for example, when someone  pushed code change for file A to remote repository and I need to pull them to my local, if in my local repository, I didn't touch file A but changed the file B, would there be a conflict for  file B? Will source tree overwrite my file B with remote repository's original file B? Thanks.

1 answer

1 accepted

0 votes
Answer accepted

The someone told you wrong. They mixed up two separate differences between git and SVN.

First, an individual git commit doesn't store the whole project. The difference they were referring to is that, for each file that has been modified, a commit in git stores the entire file, while SVN stores a diff. Unchanged files aren't included in the commit data.

That shouldn't make make much of a difference to a typical user though. The git software still calculates diffs when merging, and it also has a mechanism to compress commit data so it doesn't take up unreasonably more space than SVN commit data.

Secondly, when you clone a repository in Git, it copies the ENTIRE REPOSITORY to your machine, while SVN just copies a set of files that are associated with a particular branch. This means that you can do local operations (create/switch/delete branches, commit, tag) without connecting to the remote repository. The operations Push, Pull, and Fetch are used to keep your local repository in sync with remote ones.

To really understand the differences, check out the Git Book: https://git-scm.com/book/en/v2/Getting-Started-Git-Basics It describes all of that information very clearly, with simple examples. The git book uses git commands (not SourceTree or any other UI), but the commands typically pair directly with SourceTree terms ("git fetch" is the Fetch button, "git commit" is the Commit button, etc).

It helps. Thank you. I will take a look at the Git book. 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 23, 2018 in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

1,224 views 4 2
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