GIT和SVN命令对照表

Git Subversion Mercurial
git add <file> svn add <file> (only if the file is not tracked yet) hg add <new_file> (only if the file is not tracked yet)
git blame <file> svn blame <file> hg blame <file>
git show <rev>:<file> svn cat -r <rev> <file> hg cat -r <rev> <file>
git clone <URL> <target_name> svn checkout <URL> <target_name> hg clone <URL> <target_name>
git commit -a svn commit hg commit
git rm <file> svn delete <file> hg rm <file>
git diff <file> svn diff <file> hg diff <file>
git show HEAD:<directory> svn list <directory> hg cat -r rev <directory>
git merge svn merge hg merge
git checkout <file or directory> svn revert <file or directory> hg revert <file or directory>
git checkout HEAD svn switch <url> or svn revert <file> hg update tip
git checkout <branch> svn switch <url> hg update <branch>
git status svn status hg status
git pull svn update hg pull -u
git init svnadmin create hg init .
git fetch svn update hg pull
git reset –hard svn checkout -r <revision> url://path/to/repo hg revert -a –no-backup
git stash No equivalent, may be released in SVN 1.10?, possibly in 2017 hg shelve
git revert <commit_hash|tag|branch_name> svn merge -r UPREV:LOWREV . undo range hg backout <changeset_num|changeset_hash|tag>
svn merge -c -REV . undo single revision

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Time limit is exhausted. Please reload CAPTCHA.