Subversion and git do the same job to maintain current and historical versions of files such as source code, web pages, and documentation. But both have a different way to manage the repository.
But in recent years git got popularity. I think it is due to Github and bitbucket. Now if you want to use git in an existing project then you need to migrate your repository. There are many third-party tools that provide migration help form subversion to Github without any loss of information.
The actual challenge occurs when you are used to the svn command and look for similar command in git which can provide the same functionality as svn command.
In this blog, I will list out the svn equivalent commands in git. Also, some tasks which can do in svn easily how we can do in git.
#1: Adding a new file in the repo:
If you want to add any new file in the repository then you need to use the following command
svn add <file_name>
git add <file_name>
#2: Committing existing file to the repository:
Committing a file in svn is a simple task but in git, you need to perform the few steps. In svn committing the file in the repository which is in git like pushing file in the repo.
svn commit -m <commit_message>
git add -u
git commit -m <commmit_message>
If you have done git add and git commit then git push only needed to push your changes into the repoository.git push
#3: Copy repository to local:
To work on a project we need a local copy of the repository. Svn and git have a different way to a local copy of the repository.
svn checkout <url>
git clone <url>
#4: Know about the status of the repository:
Suppose you want to check the status of your repository, that is, is there any changes in repo or it is up to date with master or not. For this purpose svn and git has the same command.
Note: I will update more as I discover more 🙂
Read More: Sync your fork with the original repo