Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the git equivalent of "svn update -r"?

I'm a recent git convert. It's great to be able to use git-svn to keep my branches locally without disturbing the svn server. There was a bug that existed in the latest version of the code. I wanted to establish a time when it worked so that I could use git bisect. I couldn't find the right command to move back in time. Thanks.

like image 508
fratrik Avatar asked Feb 21 '09 19:02

fratrik


People also ask

What is SVN update equivalent in git?

An equivalent of "svn update" would be "git pull --rebase".

Is git clone same as SVN checkout?

To sum it up, clone is for fetching repositories you don't have, checkout is for switching between branches in a repository you already have. Note: for those who have a SVN/CVS background and new to Git, the equivalent of git clone in SVN/CVS is checkout . The same wording of different terms is often confusing.


2 Answers

git checkout HEAD~1 

This will move your current HEAD to one revision earlier.

git checkout <sha> 

This will move your current HEAD to the given revision. Use git log or gitk to find the revision you’re looking for.

like image 92
Bombe Avatar answered Sep 27 '22 20:09

Bombe


And getting back to latest (equivalent to: svn up), you'll need to update the branch, usually:

git checkout master 

This is because the HEAD refers to the version that is being checked out.

like image 27
jmu Avatar answered Sep 27 '22 19:09

jmu