1. 程式人生 > >git-svn — 讓git和svn協同工作 【工具版】

git-svn — 讓git和svn協同工作 【工具版】

background

My company is using SVN to be code management tool. I have no rights to commit, and I must export the different files to my leader to commit. For my local work conveniently , I need a local repository. So I research git and svn, and find they can cooperate.

Environments prepare

Clone project

  1. Open SmartGit , click the navigation : Repository -> Clone…

    這裡寫圖片描述
    這裡寫圖片描述
    這裡寫圖片描述
    Noted, there are two patterns. The first is to clone all versions, and the second is to clone from the specified version. The second spends less time, which applies for cloning branch temporally, such as for bug fix.

Local develop using git

  1. Pull the latest code
    Click the repository, and click Pull button.
    這裡寫圖片描述
    2.Save local change
    Select the changed files, and click Commit button
    這裡寫圖片描述
    Input some message to mark
    這裡寫圖片描述
    There are no changed files any more. If you want to look the detail, click the button Log.
    這裡寫圖片描述
    There are some other useful functions besides mentioned, and you can try to use it.

Export the changed files

As SmartGit has no export function, I exported the changed files by TortoiseGit.
1.In project root directory, right click TortoiseGit -> Show log
• If you want to export in one commit, please select the commit in the log, and execute like below.
這裡寫圖片描述
• If you want to export many commits, you need to combine these commits first like below, and then export like export one commit.
這裡寫圖片描述