SVN revert equal in Git

Using git, coming from SVN and want to revert changes on a file? In SVN it used to be:

svn revert filename

Well revert in git isn’t what you want to do in this case. Due to it’s local repository you have to think a bit different here. When checking out you get the latest committed version from your local repository, so what you actually have to do is the following:

git checkout filename

Now you have the equivalent to the gold old revert.

Advertisements

git svn status

Working with git-svn and need to know what your svn status would look like? Well within two lines you could be there. First make sure that your remotes/git-svn is up to date:

git svn fetch

Now you can a diff over that branch:

git diff --name-status remotes/git-svn

You should now see your standard diff. In case this didn’t work or your not sure where your default branch is lying, enter the command:

git branch -a

This will show you all your local and remotely tracked branches. Which looked in my case like this:


* master
remotes/git-svn