TortoiseGit: What's the difference between "Git Sync", "Fetch" and "Pull"?

Viewed 34919

I am moving from TortoiseSvn to TortoiseGit. But enountered some unexpected difficulties.

My working paradigm is as simple as:

  1. Check out code
  2. Change some code
  3. Share with others for code review
  4. Commit changes

Why bother to have the 3 syntactically similar commands below?

And Pull and Fetch even share the identical icon. What a user-friendly design!

enter image description here

2 Answers

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.

Related