29

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

smwikipedia
  • 61,609
  • 92
  • 309
  • 482
  • 1
    I would recommend that you start reading a Git tutorial, because you should not proceed further until you know these basics. I could give an answer, but there will still be many more questions you will have. – Tim Biegeleisen Mar 14 '16 at 08:31
  • @TimBiegeleisen Yes, I am reading this (http://rogerdudler.github.io/git-guide/). Hope it can un-puzzle me. – smwikipedia Mar 14 '16 at 08:43

2 Answers2

50

These are three different commands:

  1. Git pull is a git fetch followed by git merge - read here
  2. Git fetch fetches info about remote repositories - read here
  3. Git 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

Community
  • 1
  • 1
Tomasz Madeyski
  • 10,742
  • 3
  • 50
  • 62
4

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.

Saurabh Oza
  • 169
  • 4
  • 18