wiki:TipAndDoc/scm/git

Version 23 (modified by mitty, 11 years ago) (diff)

--

Git

git-svn

convert svn repos to git

  • trunk/tags/branches -> -s オプションで拾える
  • vendor -> 手動でconfig --addしてfetch
  • リモートブランチをローカルブランチへ変更する
  1. mitty@test:~/works$ git svn init -s http://lab.mitty.jp/svn/lab/ lab
    Initialized empty Git repository in /home/mitty/works/lab/.git/
    
  2. mitty@test:~/works/lab (master)$ cat .git/config
    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    [svn-remote "svn"]
    	url = http://lab.mitty.jp/svn/lab
    	fetch = trunk:refs/remotes/trunk
    	branches = branches/*:refs/remotes/*
    	tags = tags/*:refs/remotes/tags/*
    
  3. mitty@test:~/works/lab (master)$ git config --add svn-remote.svn.fetch "vendor:refs/remotes/vendor"
    [core]
    	repositoryformatversion = 0
    	filemode = true
    	bare = false
    	logallrefupdates = true
    [svn-remote "svn"]
    	url = http://lab.mitty.jp/svn/lab
    	fetch = trunk:refs/remotes/trunk
    	branches = branches/*:refs/remotes/*
    	tags = tags/*:refs/remotes/tags/*
    	fetch = vendor:refs/remotes/vendor
    
  4. mitty@test:~/works/lab (master)$ git svn fetch
    Checked out HEAD:
      http://lab.mitty.jp/svn/lab/trunk r204
    creating empty directory: TipAndDoc/tools/trac/plugins
    
    • mitty@test:~/works/lab (master)$ ls -1F
      Commentary/
      Dev/
      misc/
      TipAndDoc/
      
    • mitty@test:~/works/lab (master)$ git tag -l
    • mitty@test:~/works/lab (master)$ git br -a
      * master
        remotes/tags/r89-trunk
        remotes/tags/snuploader_name
        remotes/tags/snuploader_name@29
        remotes/tags/snuploader_name@36
        remotes/tags/twitter
        remotes/trunk
        remotes/twitter-0.1
        remotes/twitter-0.1@44
        remotes/twitter-0.1@65
        remotes/twitter-0.1@66
        remotes/vendor
      
  5. mitty@test:~/works/lab (master)$ mv .git/refs/remotes/tags/* .git/refs/tags/
  6. mitty@test:~/works/lab (master)$ rmdir .git/refs/remotes/tags/
  7. mitty@test:~/works/lab (master)$ mv .git/refs/remotes/* .git/refs/heads/
  8. mitty@test:~/works/lab (master)$ rmdir .git/refs/remotes/
  9. vim .git/packed-refs
    :%s/refs\/remotes\/tags/refs\/tags/g
    :%s/refs\/remotes/refs\/heads/g
    
    • リポジトリがある程度以上の大きさの場合、必要になる
    • .git/packed-refs が存在しない場合はskipしてよい模様
  • mitty@test:~/works/lab (master)$ git tag -l
    r89-trunk
    snuploader_name
    snuploader_name@29
    snuploader_name@36
    twitter
    
  • mitty@test:~/works/lab (master)$ git br -a
    * master
      trunk
      twitter-0.1
      twitter-0.1@44
      twitter-0.1@65
      twitter-0.1@66
      vendor
    
    • mitty@test:~/works/lab (master)$ git co vendor
      Switched to branch 'vendor'
      
    • mitty@test:~/works/lab (vendor)$ ls -1F
      DrRacket/
      GeSHi-1.0.8.9/
      lxc/
      OCaml/
      SnUploader/
      TipAndDoc/
      trac/
      twitter/
      ubuntu/
      utvpn/
      vmware/
      

git-http-backend

  • Ubuntu 12.04では、fcgiwrapパッケージを導入すると/var/run/fcgiwrap.socketが自動的に作成される

prompt

  • bash

github

gitweb

  • 以下の様に設定するのがすっきりすると思われる
    	location ~ /gitweb/(.*) {
    		fastcgi_pass unix:/var/run/fcgiwrap.socket;
    		fastcgi_param SCRIPT_FILENAME /usr/share/gitweb/gitweb.cgi;
    		include fastcgi_params;
    		fastcgi_param PATH_INFO $1;
    	}
    
    • /gitweb/(.*)/gitweb(/.*)とすると、リンクが正常に生成されないので注意