Git svn concise Use tutorial

Source: Internet
Author: User
Tags using git git commands

???? 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.