2018. 6. 14. 14:42

1. 조사배경

  - 회사에서는 SVN을 사용함

  - 개별 기능 개발이 많음

  - SVN active/stable merge시 오래걸림. (or 수동)


2. 참고

http://jevon.org/wiki/Synchronising_SVN_and_Git


* 한 참 조사하다가 모든것을 아우르는 블로그를 찾았다. ㅠ.ㅠ (3일동안 삽질했지만 정말로 좋은 사이트 찾은것 같다.

3. 원문

Synchronising SVN and Git

SVN / Git
  1. Re-establishing a git svn clone on a separate machine
I wanted to clone my existing SVN repository, https://code.google.com/p/svntime/, into a new Git repository https://github.com/soundasleep/svntime.

Based on Using Git with Subversion and Importing from Subversion.

Note that this means that all revisions and issues will all appear to come from the same user. Setting up SVN/Git synchronisation to support multiple users with correct authentication requires a lot of extra architecture and work and security for storing passwords.

0. Create a map of SVN authors to Git authors


This will let Github blame your commits properly with the -A flag. For example svn-authors.txt:

soundasleep@gmail.com = Jevon Wright <jevon@jevon.org>
soundasleep = Jevon Wright <jevon@jevon.org>
(no author) = Google Code <code@google.com>

1. Clone remote SVN into local Git

  1. Execute git svn clone -s https://svntime.googlecode.com/svn/ svntime -A svn-authors.txt --prefix=origin/ (NOT the /trunk dir! The -s flag assumes /trunk.)
You can also do subdirectories within the repository for subprojects without the -s flag, e.g. git svn clone https://svntime.googlecode.com/svn/trunk/sub-project/ sub-project -A svn-authors.txt.

2. Push local Git into remote Git

  1. Create a new empty Git repository on Github
  2. Add the remote origin source: git remote add origin https://github.com/soundasleep/svntime.git
  3. Push the SVN commits to Git: git push origin master
This will create individual commits for each SVN revision.

3. Make a local change, commit to both Git and SVN

  1. Modify a file.
  2. Commit it to local Git: git add -A && git commit
  3. Push it to remote Git: git push
  4. Commit it to remote SVN: git svn dcommit
  5. Setup the remote Git as the remote origin: git branch --set-upstream-to=origin/master master

4. Merge remote SVN changes into local Git

  1. Update the local Git from remote SVN: git svn rebase -A ../svn-authors.txt (each revision will appear as a new commit)
  2. Push to remote Git: git push

5. Merge remote Git changes into SVN

  1. Pull from remote Git into local Git: git pull
  2. Update the local Git from remote SVN: git svn rebase -A ../svn-authors.txt
  3. Commit changes to remote SVN: git svn dcommit (each commit will appear as a new revision)
If you correctly set up the author map list, then your Github will correctly recognise old commits.

6. Merge a Pull Request

  1. For example, https://github.com/soundasleep/openclerk/pull/1
  2. Follow the Github command line instructions to checkout the pull request branch as a separate remote branch
  3. Execute git rebase to rebase this branch to the latest master - you'll probably have to git mergetool a lot, since the branch will have no knowledge of master's commits
  4. git push and git svn dcommit as usual

Unable to extract revision information from commit


If you get this during a git svn dcommit, then you've probably messed up the merge somewhere - you need to git rebase before you merge changes between branches.

git svn rebase: Unknown option: strategy-option


Good luck. I think this is a bug.

ignore-paths not matching files


It turns out the regexp accepted by --ignore-paths is not a complete regexp; it needs an anchor (^ or $) in order to match. So instead of doing something like --ignore-paths=".+custom.css", you need to do --ignore-paths="custom.css$".


Posted by citrine
2018. 4. 23. 14:08

1. 조사 배경

  기존의 Repository가 확장된 개념으로 사용하게 됨에 따라 이름 변경이 필요함


2. 적용법

  단순히 mv를 하면 된다고 한다;;;; (확인은 안해봄)


3. 기타

  단순히 Display Name을 바꿀려면 

  

  • Edit .git/description to contain the repository's name.
  • Save the file.


  • 이렇게 하면 된다고 한다. 

    Posted by citrine
    2017. 8. 28. 13:32
    Right click on the file -> Replace With -> Index



    알면 아주 쉽다;;;;

    Posted by citrine
    2017. 2. 20. 16:03

    1. 증상 : git switch 시 너무 오래 걸림

    2. 환경 :  다중 사용자 환경, branch 많음

    3. 해결 : git gc (일주일에 한번 정도 한다.)


    # 참고

    http://stackoverflow.com/questions/55729/how-often-should-you-use-git-gc


    Posted by citrine
    2016. 9. 8. 15:18

    <환경정보> 

    CentOS 6.5 또는 7.0 


    <GIT 설치>

     # yum install git 



    <GIT 서버 환경 설정>

    - 사용자 추가 

    # git config --global user.name "rikky" 

    # git config --global user.email "rikky@somansa.com" 


    - 기타 환경설정 

    # git config --global color.ui auto 

    # git config --global alias.st status


    <설정확인> 

    # git config -l 


    <GIT 서버에 원격 저장소 만들기>

    git에는 bare-repository랑 nonbare-repository가 있다. 

    우리가 일반적으로 사용하는 로컬 저장소는 nonbare-repository라 할 수 있다. 

    그리고 우리가 원격저장소로 사용하는 것은 bare-repository라 할 수 있다. 

    저 둘 사이에는 엄연한 차이가 있는데, nonbare-repository는 작업트리로 부르기도 하며, 실제 프로젝트 리소스가 들어있다. 

    bare-repository는 원격저장소로, 실제 프로젝트 리소스가 아닌 이력, 변경 사항들이 들어가 있으며, 이 데이터를 기반으로 작업트리를 구성할 수 있게 된다.


    # cd /home/git/git_repo : Repository 디렉토리로 이동

     # git init --bare test_project.git : bare repository 생성 


    <내 PC에서 Git 원격저장소 연결하기>

     Git Bash 를 실행후 다음과 같이 입력한다.

     # git clone ssh://git@192.168.0.149:/home/git/git_repo/test_project.git "test_project"




    # 참고

    http://artwook.tistory.com/entry/CentOS-65%EC%97%90%EC%84%9C-Git-%EC%84%9C%EB%B2%84-%EC%84%A4%EC%B9%98-%EB%B0%8F-%ED%99%98%EA%B2%BD%EC%84%A4%EC%A0%95


    Posted by citrine
    2016. 9. 8. 09:31

    1. Eclipse, TortoiseGIT 공용 URI 설정

      Remote Fetch URL ssh://rikky@192.168.9.51/home/git/git_repo/dbdiscover.git


    2. TortoiseGIT  전용 URI 설정

      Remote Fetch URL ssh://rikky@192.168.9.51:/home/git/git_repo/dbdiscover.git


    3. 차이점 : Eclipse에서는 ":"를 사용하면 문제 발생하므로 ':'를 사용하지 않는 공용 URI 설정법으로 한다.

    Posted by citrine