简体   繁体   中英

Advice on SVN <-> Git Workflow

I'm having a problem using Git. Bear in mind I'm very new to Git.

The problem: I need to sync my work to my home/mobile. My workplace uses SVN and it cannot be accessed from outside (I can't change this). I'm also blocked from sshing to outside (I can't change this too). Back at my house, I need to commit my changes.

Proposed solution:

SVN Server -> Git (in my Office PC) -> Github -> Git (in my House PC)
SVN Server <- Git (in my Office PC) <- Github <- Git (in my House PC)

The reason I'm choosing Github is because of its HTTPS support, this will solve my problem in sshing to outside of my office.

So, my question is:

  1. Is this the correct way to do it?
  2. If it is good enough, can anyone give me a rough example on how can I do this?

I know 2nd question is a big one, but I'm having trouble merging my changes from my house back to the SVN server. Thanks in advance.

Update:

I've actually cosider using a USB drive as the medium to transfer my Git repository. However, I was hoping for a way so that I don't have to use USB drive at all (all automatically sorted in the Internet and was afraid I'll drop my USB somewhere). I even used Dropbox for a while, but then, the repository started to get too big and Dropbox doesn't play well with a lot of small files (more than 20,000).

After some consideration (the complexity of the process, the sensitivity of the data), I think I'll just USB drive to transfer my Git repository. However, I'll keep the question open so that I can learn some Git commands from this problem.

By the way, this is my current workflow in general:

  1. SVN Server -> Git (Office PC) -> Github -> Git (House PC) No Problem
  2. At my house: Created a login branch and pushed it back to Github.
  3. At the office: For the first time, I cloned back from my Github repository and merge the login branch.
  4. Then, git svn init svn://url -s
  5. ???

I've tried a few commands, but I don't think it's working, was hoping someone could help starting with step 5.

假设工作不希望您将代码库推送到GitHub,即使在私有仓库中,您也可以将远程仓库添加到已安装的USB驱动器中,并来回传送它。

A few things come to mind:

  1. Storing corporate data on Github may very well be against corporate security policies.
  2. git-svn repositories are not meant to be shared between computers.

Perhaps a good option would be to git svn clone the repository onto a flash drive. Then take that home, work on it, and build up commits. Then you can git svn rebase && git svn dcommit from the repository when you get to work, as per the normal git-svn workflow.

EDIT: Have you considered running sshd on an alternate port or proxying SSH over HTTP(S)? I've had good luck in the past with one technique or the other, depending on the restrictions in effect. It may not be kosher, but I'm sure it's a hell of a lot better than storing your company's source code on Github.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM