Git For Subversion Users

git

How can we accomplish what we used to accomplish with 'svn revert'?

Use the 'git checkout' command:

git checkout -- fileName

The 'svn revert' command is used to discard local changes made to a file. To accomplish the same thing, use the 'git checkout' command as demonstrated above.

How can we accomplish what we used to accomplish with 'svn resolved'?

When using Subversion, if there is a conflict, we have to manually resolve it, and then use the 'svn resolved' command to mark the file as resolved. With Git, there is no 'resolved' command. If there is a conflict, we have to manually resolve it just like we do when we use Subversion, and then we simply use the 'git add' command as though there was no conflict.

How can we accomplish what we used to accomplish with 'svn switch'?

git checkout branchName

In the above command.

We used the 'svn switch' command to switch our working copy from one branch to another branch. To accomplish the same thing, with Git, we use the 'git checkout' command as mentioned above.

How can we accomplish what we used to accomplish with 'svn merge'?

git pull

git merge branchName

The 'git pull' command do a fetch and then automatically merge the changes into the current working copy. In the above code, branchName is the name of a branch that exist on the local repository.

Using Subversion, we can merge changes between two revisions:

svn merge -r rev1:rev2 http://example.com/svn/branches/branchName

into the current working copy. Or we can merge:

svn merge http://example.com/svn/branches/branchName

I am not sure exactly what the above command (without the revisions) actually do.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License