I am moving from TortoiseSvn to TortoiseGit. But enountered some unexpected difficulties.
My working paradigm is as simple as:
Why bother to have the 3 syntactically
similar commands below?
And Pull
and Fetch
even share the identical icon. What a user-friendly design!
The Sync Dialog provides an interface for all operations related with remote repositories in one dialog. This includes push, pull, fetch, remote update, submodule update, send patch... However, the sync dialog provides less options as the regarding dialogs (cf.
git fetch is the command that tells your local git to retrieve the latest meta-data info from the original (yet doesn't do any file transferring. It's more like just checking to see if there are any changes available). git pull on the other hand does that AND brings (copy) those changes from the remote repository.
Fetch just downloads the objects and refs from a remote repository and normally updates the remote tracking branches. Pull, however, will not only download the changes, but also merges them - it is the combination of fetch and merge (cf. the section called “Merging”).
It's important to fetch and pull before you push. Fetching checks if there are any remote commits that you should incorporate into your local changes. If you see any, pull first to prevent any upstream merge conflicts.
These are three different commands:
pull
is a git fetch
followed by git merge
- read here fetch
fetches info about remote repositories - read here sync
does everything in one command meaning pull
and push
read here If you want to compare git
and svn
workflow then git pull
is like svn update
. There's no direct svn
version of git fetch
. Git sync
is like svn up
&& svn commit
in one command
You can do a git fetch at any time to update your remote-tracking branches under refs/remotes//.
git fetch
operation never changes any of your own local branches under refs/heads, and is safe to do without changing your working copy. I have even heard of people running git fetch periodically in a cron job in the background (although I wouldn't recommend doing this).
git pull
is what you would do to bring a local branch up-to-date with its remote version, while also updating your other remote-tracking branches.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With