Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of "svn checkout" for git?

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

git checkout(?)

Many thanks!

like image 275
Daniel Bonetti Avatar asked Sep 19 '13 16:09

Daniel Bonetti


2 Answers

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.

like image 96
Carl Norum Avatar answered Oct 14 '22 03:10

Carl Norum


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 [email protected]:pjhyett/foo.git
# make your changes
$ git commit -a -m "my first commit"
$ git push

from Git for beginners: The definitive practical guide

like image 33
Daniel Bonetti Avatar answered Oct 14 '22 01:10

Daniel Bonetti