Well, I'm a former svn user too, and now use git for all my projects.
When using git, you should change the way of thinking from client-server architecture that used in svn. In svn, every change need connection with server. Using git, your repo is in the working directory. You don't need connection to every repo action.
Only use git push
and git pull
to synchronize between repo. Think of it like using rsync or any backup solution, to make two place have exactly same content. Just like you connect external backup harddisk, then make the content in it same with the content in your main. That's the usage of git pull
and git push
.
If you just want to go back and forth the history, do it using git checkout
. See the revision id using git pull
. If you using linux, use gitk
to see the revision tree. In windows, tortoise git can display it using revision graph.
To get back to latest revision, use git checkout master
. Before doing any command, make yourself always do git status
. This command will display anything you need to know about current repo condition, and what action that you need to do to make it right. Before do git pull
and git push
, it's better to make sure that git status
result is contain text working directory clean
.
If you need to revert a file to it's previous revision, you can do it with git merge
. Before doing it to file, test it first with git diff
. Ex: git diff rev1:rev2 filename
. It will print out any different between two revision. Change in rev1 will replaced by change in rev2. So to do revert, rev2 will be the older than rev1. After you satisfy with the diff result, do it with git merge
, just replace diff
with merge
, all other parameter stay the same.
I hope this help you. The main key is to see that your work dir is your repo. Understand this will make you can use git to it's full capability. Good luck.