10

What git command should I use to be equivalent to svn checkout?

git checkout(?)

Many thanks!

Zoe
  • 27,060
  • 21
  • 118
  • 148
Daniel Bonetti
  • 2,306
  • 2
  • 24
  • 33
  • 3
    Possible duplicate... or invalid question. See http://stackoverflow.com/questions/1783405/git-checkout-remote-branch – Adrien Gorrell Sep 19 '13 at 17:01
  • 1
    Did you try `git checkout`? What happened? Also, an **EXCELLENT** resource for learning how to use Git is the [**FREE** online **Pro Git** book](http://git-scm.com/book). Recommended: chapters 1-3, 6-6.5. –  Sep 20 '13 at 04:54
  • 1
    possible duplicate of [Git for beginners: The definitive practical guide](http://stackoverflow.com/questions/315911/git-for-beginners-the-definitive-practical-guide) – Ivo Sep 20 '13 at 14:36
  • 3
    I didn't try `git checkout`. I just wanna be sure about what command should I use because my repository has more than 2 GB. – Daniel Bonetti Oct 17 '13 at 17:14

2 Answers2

25

git clone is more of an analogue to svn checkout than git checkout. git checkout just checks out a branch or commit from your local repository. git clone makes a new copy of a remote repository.

Carl Norum
  • 219,201
  • 40
  • 422
  • 469
15

This is exactly what I wanted:

SVN

$ svn checkout svn://foo.googlecode.com/svn/trunk foo
# make your changes
$ svn commit -m "my first commit"

GIT

$ git clone git@github.com:pjhyett/foo.git
# make your changes
$ git commit -a -m "my first commit"
$ git push

from Git for beginners: The definitive practical guide

Community
  • 1
  • 1
Daniel Bonetti
  • 2,306
  • 2
  • 24
  • 33