博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
How to use Git and svn together
阅读量:5893 次
发布时间:2019-06-19

本文共 2607 字,大约阅读时间需要 8 分钟。

From:

 

Posted by in , ,

In these days I’ve heard lot of rumors around . After reading some manual/tutorial/guide I discovered that it can be really useful, especially if you spend lot of time coding off-line (that’s my situation).

This is a really small howto that describes how to work on a project versioned with svn (maybe taken from KDE repository ;) ) using git.

What’re the advantages?

Since Git is a distributed revision control system (while svn is a centralized one) you can perform commits, brances, merges,… on your local working dir without being connected to internet.

Next time you’ll be online, you will be able to “push” your changes back to the central svn server.

Steps to follow:

You’ve to:

  1. install git and git-svn
  2. create the working dir: mkdir strigi
  3. init your git working dir:
    cd strigi && git-svn init https://svn.kde.org/home/kde/trunk/kdesupport/strigi
    git-svn init command is followed by the address of the svn repository (in this case we point to strigi’s repository)
  4. Find a commit regarding the project (you can get it from ). Warning: the command git-log will show project’s history starting from this revision.
  5. Perform the command git-svn fetch -rREVISION
    Where REVISION is the number obtained before.
  6. Update your working dir: git-svn rebase

Now you’ll be able to work on your project using git as revision control system.

To keep update your working copy just perform:

git-svn rebase

You can commit your changes to the svn server using the command:

git-svn dcommit

In this way each commit made with git will be “transformed” into a svn one.

Solve git-svn rebase problems

While adding new cool features to your program, you may experiment some problem when synchronizing with the main development tree. In fact you have to commit all local modifications (using the git-commit command) before invoking git-svn rebase.

Sometimes it isn’t reasonable since your changes are not yet ready to be committed (you haven’t finished/tested/improved your work). But don’t worry, git has a native solution also for this problem, just follow these steps:

  1. put aside your changes using the command: git-stash
  2. update your working copy using: git-svn rebase as usual
  3. take back your changes typing: git-stash apply
  4. clear “the stash” typing: git-stash clear

After the first step all your uncommitted changes will disappear from the working copy, so you’ll be able to perform the rebase command without problems.

For further informations read git-stash man page.

That’s all.

Greetings: I would like to thank Thiago Macieira for his help.

转载于:https://www.cnblogs.com/kongs/archive/2011/08/26/2153984.html

你可能感兴趣的文章
EL 表达式小结
查看>>
内部排序
查看>>
jQuery EasyUI API 中文文档 - 组合(Combo)
查看>>
10个关于 Dropbox 的另类功用(知乎问答精编)[还是转来了]
查看>>
Oracle体系结构
查看>>
用Modelsim仿真QII FFT IP核的时候出现的Error: Illegal target for defparam
查看>>
javascript Error对象详解
查看>>
nc 局域网聊天+文件传输(netcat)
查看>>
每天一个linux命令(25):linux文件属性详解
查看>>
go微服务框架go-micro深度学习(三) Registry服务的注册和发现
查看>>
python 重载方法有哪些特点 - 老王python - 博客园
查看>>
在Fedora8上安装MySQL5.0.45的过程
查看>>
设计模式之命令模式
查看>>
android 测试 mondey
查看>>
Spring AOP项目应用——方法入参校验 & 日志横切
查看>>
使用REST-Assured对API接口进行自动化测试
查看>>
王潮歌跨界指导HUAWEI P20系列发布会 颠覆传统 眼界大开!
查看>>
王高飞:微博已收购一直播 明年一季度重点是功能与流量打通
查看>>
趣头条发行区间7至9美元 预计9月14日美国上市
查看>>
新北市长侯友宜:两岸交流应从隔壁最亲近的人开始
查看>>