???? While there are many benefits to using git, there are some historical reasons why we might have to use SVN at work, so is there a way to take into account the ideals and realities?
???? GIT provides us with the git SVN command tool, which can be used to manage SVN code in a git way. Gossip doesn't say much, formally start our git svn tutorial.
To create a warehouse:
1. Pull only a single directory:
git svn clone http://xx.xx.xx.xx/trunks/demo
2. Pull all the data on the server:
git svn clone http://xx.xx.xx.xx/demo -T your_trunk -b your_branches -t your_tags
If the directory structure on the SVN server is a standard directory that is trunk, tags, branches, you can directly use
git svn clone -s http://xx.xx.xx.xx/demo
If the history is too much, you don't need to read it all to add parameters -r1000:HEAD
, only the history change record from version 1000 to the current version is pulled.
Wait patiently for the download to complete.
GIT library operations
After the download is complete, you can use the official git command to review the common GIT commands:
git status 查看仓库状态git log 查看提交记录git reflog 查看git操作记录git add -A 添加需要提交的文件git commit -m "我是注释" 提交已add的文件到仓库git reset --hard HEAD 必得文件到最新版本
Update SVN code
git svn rebase
Submit files in Git library to SVN repository
After the local development, Git commits to the local git repository, and then submits the file to SVN using the following command:
git svn dcommit
Other tricks to use Git svn as an SVN repository broker
Due to network and other reasons, some computers may not be able to manage the code in the SVN library, causing great inconvenience to our development. The Git repository can then be used for offline versioning to build the Git SVN repository locally and use this repository as a transit to resolve versioning issues. Here is an example:
Build a local git repository, and set up a git repository named deploy under the D drive:
cd d:/git svn clone svn://x.x.x.x/test deploy
Build a development warehouse:
clone d:/deploy dev_master
Because a repository cloned with Git SVN cannot use bare as a mirrored library without a workspace, there may be Receive.denycurrentbranch ' Configuration on dev_master push Variable to refuse, this is because GIT does not allow push to non-bare libraries by default and can be configured in the deploy directory using the following configuration:
receive.denyCurrentBranch updateInstead
Submit a fixed-format comment
Some of the submitted comments may require a fixed format, when input in VI may be cumbersome, in VI type I into the input mode can be more complete paste comment content.
Git svn concise Use tutorial