LoginSignup
18
23

More than 5 years have passed since last update.

Subversion-Git連携運用

Last updated at Posted at 2014-12-05

Subversion-Git連携運用


はじめに

開発を取り巻く体制

想定している開発体制は、以下のようなもの。
相手(TeamA)がSubversion利用環境で開発しており、
こちら側(TeamB)がGitLabを利用したい場合。

  1. TeamAは通常Subversionへコミット
  2. TeamBは定期的にTeamAのソースを取り込み
  3. TeamBは定期的にTeamBのソースをマージしてTeamAへ提出

環境構成

拠点におけるサービス状況

拠点 Team SMC WAN/LAN example
会社A(拠点A) TeamA Subversion環境 WAN利用可 comA
会社B(拠点B) TeamB GitLab(Git)環境 LAN利用のみ comB

プロジェクト名とリポジトリ名

key value
プロジェクト名 HogeSampleProject
SVN Repo Name(remote) comA
Git Repo Name(remote) team1/HogeSampleProject

リモートURL

Team middle URL
TeamA SVN http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject
TeamB Git git@192.168.xxx.xxx:team1/HogeSampleProject.git

Gitローカルリポジトリに設定予定のリモートURLとリポジトリの略称

key 略称 URL
svn-remote svn http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject
remote origin git@192.168.xxx.xxx:team1/HogeSampleProject.git

Git-SVN連携を実現するツール:git-svn

git svn コマンド
SVN Repoの最初の取り込み git svn clone
SVN Repoの最新の取り込み git svn rebase
SVN Repoへのコミット git svn dcommit

Windws環境

Git Bashには含まれているようなので別途インストールする必要はない。

Linux環境

CentOSの場合
OSバンドルのgitにはgit-svnパッケージが含まれていないため、
別途インストールする必要がある。
Gitのバージョンとgit-svnパッケージのバージョンは合わせる必要がある。

key value
OS CentOS6.5
git git version 1.7.1
git-svn git-svn-1.7.1-3

CentOS6.5で事前にgitだけはインストールされている場合の「git-svn」のインストール方法

sh
wget http://dl.atrpms.net/el6-i386/atrpms/stable/atrpms-77-1.noarch.rpm
sudo rpm -ivh atrpms-77-1.noarch.rpm
wget http://dl.atrpms.net/el6-x86_64/atrpms/stable/perl-TermReadKey-2.30-3.el6.x86_64.rpm
sudo rpm -ivh perl-TermReadKey-2.30-3.el6.x86_64.rpm
wget ftp://rpmfind.net/linux/centos/6.5/os/x86_64/Packages/git-svn-1.7.1-3.el6_4.1.noarch.rpm
sudo rpm -ivh git-svn-1.7.1-3.el6_4.1.noarch.rpm

TeamAでの作業概要

  1. TeamB用のコミッターアカウントを作成する。(最低1アカウント)
  2. SVNのリポジトリを公開する。
  3. TeamB用のコミッターアカウントを配布する。

TeamBでの作業概要

<TeamBのGit-SVNリポジトリ管理者の作業>

Gitローカルリポジトリの準備

  1. git-svnの準備(Windows環境の場合はGitインストール時に導入済み)
  2. 公開されたSVNのリポジトリを中央リポジトリとして、「git svn clone」する(初回のみ)
  3. 公開されたSVNのリポジトリの最新を取得する。「git svn rebase」
  4. 取り込んだ直後のconfigの確認

Gitリモートリポジトリの準備

拠点B、LAN内部に、GitLabにて、Git Remote Repository を作成する。
GitのRemote Repositoryを「origin」とし、Gitローカルリポジトリに設定する。

Gitローカル&リモートリポジトリの準備

  1. Git Flowを適用する。
  2. master ブランチ作成
  3. develop ブランチ作成
  4. feature ブランチ作成(feature/myfeat1)
  5. origin/master ブランチにpushする。
  6. origin/develop ブランチにpushする。
  7. origin/feature/myfeat1 ブランチにpushする。

TeamBのGit-SVNリポジトリ管理者は、TeamBのメンバーに周知する

TeamBでの実際の作業

Step1:<TeamBのGit-SVNリポジトリ管理者の作業>

Gitローカルリポジトリの準備

※SVNリポジトリのtrunk配下もしくはbranches配下のプロジェクト名を直に指定する場合
「git svn clone」のコマンドオプションはつけなくていいようだ。

mkdir /c/Users/fuga/git
cd /c/Users/fuga/git
git svn clone http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject
cd HogeSampleProject
git svn rebase

※注意点
SVNリポジトリ名:hoge1
管理しているリポジトリのSVNブランチ郡も含めて取り込みたいときには、「-s」付与する。
今回は、trunkの配下にボリュームの大きいプロジェクトが多数ぶら下がっているため、使用してはいけない。

command memo
1 git svn clone http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject 今回
2 git svn clone http://hoge.com/repos/HogeSampleRepo -s 容量大きすぎのため採用せず

Gitチームの作成

http://192.168.xxx.xxx:88/admin/groups/new
team1

team1にメンバー追加
add fuga
add poyo

Gitリモートリポジトリの準備

key value
Namespace team1
Project name HogeSampleProject
Customize repository name? HogeSampleProject
Description HogeSampleProject

作成後のURL
http://192.168.xxx.xxx:88/admin/projects/team1/HogeSampleProject
http://192.168.xxx.xxx:88/team1/HogeSampleProject

Gitローカル&リモートリポジトリの準備

  1. GitのRemote Repoを追加し、masterをあげておく
git remote add origin git@192.168.xxx.xxx:team1/HogeSampleProject.git
git branch -a
git push origin master
  1. Git Flow の採用
  2. developをあげておく
  3. 開発者用にfeature/myfeat1を作成しあげておく
git flow init
git branch -a
git push origin develop:develop
git flow feature start myfeat1
git branch -a
git push origin feature/myfeat1:feature/myfeat1

TeamBのGit-SVNリポジトリ管理者は、TeamBのメンバーに周知する

  1. TeamBの開発メンバーに Git Remote Repoの情報を周知し、
  2. 各自のfeatureブランチをチェックアウトさせ、
  3. ワークブランチを切て開発スタートすることを伝える

※Chatで周知
http://192.168.xxx.xxx:88/team1/HogeSampleProject/wall

周知内容(一例)

◆Git global setup:
git config --global user.name "fuga"
git config --global user.email "tarou.fuga@hoge.com"

◆Create Repository
mkdir HogeSampleProject
cd HogeSampleProject
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@192.168.xxx.xxx:team1/HogeSampleProject.git
git push -u origin master

◆Existing Git Repo?
cd existing_git_repo
git remote add origin git@192.168.xxx.xxx:team1/HogeSampleProject.git
git push -u origin master

Gitローカルリポジトリのconfig確認

git config --list
key value
http.sslcainfo /bin/curl-ca-bundle.crt
sendemail.smtpserver /bin/msmtp.exe
diff.astextplain.textconv astextplain
rebase.autosquash true
user.name fuga@HogePC
user.email tarou.fuga@hoge.com
core.quotepath false
core.autocrlf input
push.default upstream
core.repositoryformatversion 0
core.filemode false
core.bare false
core.symlinks false
core.ignorecase true
core.hidedotfiles dotGitOnly
core.logallrefupdates true
core.quotepath false
core.autocrlf true
user.name fuga@HogePC
user.email tarou.fuga@hoge.com
color.ui auto
svn-remote.svn.url http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject
svn-remote.svn.fetch :refs/remotes/git-svn
remote.origin.url git@192.168.xxx.xxx:team1/HogeSampleProject.git
remote.origin.fetch +refs/heads/:refs/remotes/origin/
gitflow.branch.master master
gitflow.branch.develop develop
gitflow.prefix.feature feature/
gitflow.prefix.release release/
gitflow.prefix.hotfix hotfix/
gitflow.prefix.support support/
gitflow.prefix.versiontag

Gitローカルリポジトリのconfigファイルの設定内容確認

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
    logallrefupdates = true
    quotepath = false
    autocrlf = true
[user]
    name = fuga@HogePC
    email = tarou.fuga@hoge.com
[color]
    ui = auto
[svn-remote "svn"]
    url = http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject
    fetch = :refs/remotes/git-svn
[remote "origin"]
    url = git@192.168.xxx.xxx:team1/HogeSampleProject.git
    fetch = +refs/heads/*:refs/remotes/origin/*
[gitflow "branch"]
    master = master
    develop = develop
[gitflow "prefix"]
    feature = feature/
    release = release/
    hotfix = hotfix/
    support = support/
    versiontag = 

TeamBでの通常作業の概要

<TeamBの開発者の作業>

  1. Git Remote Repositoryをcloneする。
  2. Git Remote Repositoryより、自分のfeatureブランチを取り込む。
  3. 自分のfeatureブランチから派生させたworkブランチを作成する。
  4. workブランチにて開発を行う。

開発の区切りを迎えたとき

  1. ワークブランチのコミット履歴を整理する
  2. ワークブランチの開発が一旦終了したので、開発者は、自分のfeatureブランチにマージしPUSH予定であることを周知する

TeamBでの通常作業の実際

Step2:<TeamBの開発者の作業>

  1. Git Remote Repositoryをcloneする。
mkdir /c/Users/fuga/git
git clone git@192.168.xxx.xxx:team1/HogeSampleProject.git
cd HogeSampleProject
  1. Git Remote Repositoryより、自分のfeatureブランチを取り込む。
git fetch origin
git pull
git branch -a
git checkout myfeat1
  1. 自分のfeatureブランチから派生させたworkブランチを作成する。
git checkout -b myfeat1_work1
git branch -a
git status
  1. workブランチにて開発を行う。
git checkout myfeat1_work1
vi README.md
git add README.md
git commit -m "add README.md"
vi README.md
git add README.md
git commit -m "add README.md 2"
...

以降、自分のワークブランチ(ローカルリポジトリ)には、がんがんコミットしていく。

ワークブランチのコミット履歴を整理

分岐元のコミットIDを指定して、コミットをひとつにまとめる

サンプルを以下に示します。

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$ git rebase -i feature/myfeat1
pick e9ac817 add README.md
squash 779e6a9 add README.md 2

# Rebase b91f33d..779e6a9 onto b91f33d
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out

この時協業他社のSVNチーム(TeamA)が、trunkに何かコミットを行う

この時点では、Gitチーム(TeamB)は誰も気づいていない状態
※実際には「teamSVN_memo.txt」が新規に追加されたとする。

TeamB開発者featureのPUSH宣言

ワークブランチの開発が一旦終了したので、開発者は、自分のfeatureブランチにマージしPUSH予定であることを周知する

※Chatで周知
http://192.168.xxx.xxx:88/team1/HogeSampleProject/wall

まだPUSHはしない。

開発者の宣言をうけて、
TeamBのGit-SVNリポジトリ管理者がGit-SVNリポジトリ間の調整を行う。

Git-SVNリポジトリ間の調整作業概要

<TeamBのGit-SVNリポジトリ管理者>

  1. Gitチームのリポジトリ管理者は、SVNのtrunkをmasterブランチに取り込む
  2. 続いて、developに取り込む
  3. Gitのリモートリポジトリにあげる
  4. そして、チームのメンバーに最新を取り込むように周知する

Git-SVNリポジトリ間の調整作業実際

<TeamBのGit-SVNリポジトリ管理者>

Gitチームのリポジトリ管理者は、SVNのtrunkをmasterブランチに取り込む

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$ git checkout master
Switched to branch 'master'

fuga@HogePC ~/git/HogeSampleProject (master)
$ git svn rebase
        A       teamSVN_memo.txt
r16863 = 64c952a0f46b10593b7043c2222cc6d4351ee0ac (refs/remotes/git-svn)
        M       teamSVN_memo.txt
r16864 = 99cece6e00f05ff0c579d3e8e0d81f81e2bea3ba (refs/remotes/git-svn)
First, rewinding head to replay your work on top of it...
Fast-forwarded master to refs/remotes/git-svn.

fuga@HogePC ~/git/HogeSampleProject (master)
$ ls -la
total 9
drwxr-xr-x    7 fuga Administ     4096 Dec  3 16:48 .
drwxr-xr-x    1 fuga Administ     4096 Dec  3 15:54 ..
drwxr-xr-x    1 fuga Administ     4096 Dec  3 16:48 .git
-rw-r--r--    1 fuga Administ      928 Dec  3 15:56 .project
-rw-r--r--    1 fuga Administ     2430 Dec  3 15:56 build.gradle
drwxr-xr-x    1 fuga Administ        0 Dec  3 15:56 src
-rw-r--r--    1 fuga Administ      141 Dec  3 16:48 teamSVN_memo.txt

続いて、developに取り込む

fuga@HogePC ~/git/HogeSampleProject (master)
$ git checkout develop
Switched to branch 'develop'

fuga@HogePC ~/git/HogeSampleProject (develop)
$

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git merge master
Updating b91f33d..99cece6
Fast-forward
 teamSVN_memo.txt | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 teamSVN_memo.txt

fuga@HogePC ~/git/HogeSampleProject (develop)
$

Gitリポジトリ管理者は、リモートにあげる。

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git push origin develop:develop
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 776 bytes | 0 bytes/s, done.
Total 6 (delta 3), reused 0 (delta 0)
To git@192.168.xxx.xxx:team1/HogeSampleProject.git
 * [new branch]      develop -> develop

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git push origin master:master
Total 0 (delta 0), reused 0 (delta 0)
To git@192.168.xxx.xxx:team1/HogeSampleProject.git
   b91f33d..99cece6  master -> master

fuga@HogePC ~/git/HogeSampleProject (develop)
$

そして、チームのメンバーに最新を取り込むように周知する。

※Chatで周知
http://192.168.xxx.xxx:88/team1/HogeSampleProject/wall

TeamBの開発者のマージ&PUSHまでの作業:概要

<TeamBの開発者>

TeamBの開発者は、まず(SVN最新取込済みの)リモートの最新情報を取り込む

  1. 最新のdevelopを取り込む
  2. そして自分のfeatureに取り込む
  3. そして、自分のワークブランチにも取り込む

ここではじめて、自分の開発したワークブランチの内容をfeatureにマージする

  1. ワークブランチの内容をfeatureにマージする
  2. そして、自分のfeature をPUSHする。

TeamBの開発者のマージ&PUSHまでの作業:実際

開発者は最新のdevelopを取り込む

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git pull origin develop:develop
Already up-to-date.

fuga@HogePC ~/git/HogeSampleProject (develop)
$

そして自分のfeatureに取り込む

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git checkout feature/myfeat1
Switched to branch 'feature/myfeat1'

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git merge develop
Updating b91f33d..99cece6
Fast-forward
 teamSVN_memo.txt | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 teamSVN_memo.txt

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$

そして、自分のワークブランチにも取り込む

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git checkout myfeat1_work1
Switched to branch 'myfeat1_work1'

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$ git merge feature/myfeat1
Merge made by the 'recursive' strategy.
 teamSVN_memo.txt | 5 +++++
 1 file changed, 5 insertions(+)
 create mode 100644 teamSVN_memo.txt

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$

ここではじめて、自分の開発したワークブランチの内容をfeatureにマージする

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$ git checkout feature/myfeat1
Switched to branch 'feature/myfeat1'

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git merge myfeat1_work1
Updating 99cece6..ed5be13
Fast-forward
 README.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 README.md

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$

そして、自分のfeature をPUSHする。

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git push origin feature/myfeat1:feature/myfeat1
Counting objects: 7, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 776 bytes | 0 bytes/s, done.
Total 5 (delta 2), reused 0 (delta 0)
To git@192.168.xxx.xxx:team1/HogeSampleProject.git
 * [new branch]      feature/myfeat1 -> feature/myfeat1

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$

PUSHしたことを周知する。

※Chatで周知
http://192.168.xxx.xxx:88/team1/HogeSampleProject/wall

Gitリポジトリ管理者によるGit-SVNマージ作業概要

<Gitリポジトリ管理者>

  1. Gitリポジトリ管理者は、origin/developに、feature/myfeat1を取り込む
  2. Gitリポジトリ管理者は、origin/masterに、developを取り込む
  3. (重要)Gitリポジトリ管理者は、origin/masterにマージした内容を、SVNのtrunkにコミットする(先にSVNへコミット)「git svn dcommit」
  4. ここで、git log を確認しておく
  5. developにcheckoutして、git log して、差があることを認識しておく
  6. developにmasterを取り込んでおく
  7. (重要)Gitリポジトリ管理者は、Gitリモートリポジトリのほうにも、PUSHする(SVNへのコミットのあとにGitにPUSH)
  8. Gitリポジトリ管理者は、メンバーに周知する

Gitリポジトリ管理者は、origin/developに、feature/myfeat1を取り込む

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git checkout develop
Switched to branch 'develop'

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git pull origin feature/myfeat1:feature/myfeat1
Updating 99cece6..ed5be13
Fast-forward
 README.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 README.md

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git merge feature/myfeat1
Already up-to-date.

fuga@HogePC ~/git/HogeSampleProject (develop)
$

Gitリポジトリ管理者は、origin/masterに、developを取り込む

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git checkout master
Switched to branch 'master'

fuga@HogePC ~/git/HogeSampleProject (master)
$ git merge develop
Updating 99cece6..ed5be13
Fast-forward
 README.md | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 README.md

fuga@HogePC ~/git/HogeSampleProject (master)
$

(重要)Gitリポジトリ管理者は、origin/masterにマージした内容を、SVNのtrunkにコミットする(先にSVNへコミット)

$ git status
On branch master
nothing to commit, working directory clean

fuga@HogePC ~/git/HogeSampleProject (master)
$ git svn dcommit
Committing to http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject ...
        A       README.md
Committed r16865
        A       README.md
r16865 = d4cf8ded26e4e04f5dd8884a751844e883d8e268 (refs/remotes/git-svn)
W: 0f276906644be17e7bcb4c793efeec825d9e47ab and refs/remotes/git-svn differ, using rebase:
:000000 100644 0000000000000000000000000000000000000000 fafb0e19ce4f84e73e2f007c6c194776a7f16e06 A      teamSVN_memo.txt
First, rewinding head to replay your work on top of it...
# of revisions changed
before:
 ed5be13a04b08051991c2517452e2a568dcff5ca

after:

 If you are attempting to commit  merges, try running:
         git rebase --interactive --preserve-merges  refs/remotes/git-svn
Before dcommitting

fuga@HogePC ~/git/HogeSampleProject (master)
$

ここで、git log を確認しておく

fuga@HogePC ~/git/HogeSampleProject (master)
$ git log
commit d4cf8ded26e4e04f5dd8884a751844e883d8e268
Author: P13002 <P13002@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 08:07:27 2014 +0000

    add README.md

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16865 95ca04d6-2a50-f641-9c15-0b33580292c1

commit 99cece6e00f05ff0c579d3e8e0d81f81e2bea3ba
Author: G14077 <G14077@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 07:42:37 2014 +0000

    協業他社のSVNチームが、trunkに何かコミットを行う。2

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16864 95ca04d6-2a50-f641-9c15-0b33580292c1

commit 64c952a0f46b10593b7043c2222cc6d4351ee0ac
Author: G14077 <G14077@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 07:41:49 2014 +0000

    この時協業他社のSVNチームが、trunkに何かコミットを行う

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16863 95ca04d6-2a50-f641-9c15-0b33580292c1


fuga@HogePC ~/git/HogeSampleProject (master)
$

developにcheckoutして、git log して、差があることを認識しておく

fuga@HogePC ~/git/HogeSampleProject (master)
$ git checkout develop
Switched to branch 'develop'

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git log
commit ed5be13a04b08051991c2517452e2a568dcff5ca
Merge: 0f27690 99cece6
Author: fuga@HogePC <tarou.fuga@hoge.com>
Date:   Wed Dec 3 16:57:13 2014 +0900

    Merge branch 'feature/myfeat1' into myfeat1_work1

commit 99cece6e00f05ff0c579d3e8e0d81f81e2bea3ba
Author: G14077 <G14077@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 07:42:37 2014 +0000

    協業他社のSVNチームが、trunkに何かコミットを行う。2

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16864 95ca04d6-2a50-f641-9c15-0b33580292c1

commit 64c952a0f46b10593b7043c2222cc6d4351ee0ac
Author: G14077 <G14077@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 07:41:49 2014 +0000

    この時協業他社のSVNチームが、trunkに何かコミットを行う

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16863 95ca04d6-2a50-f641-9c15-0b33580292c1

commit 0f276906644be17e7bcb4c793efeec825d9e47ab

fuga@HogePC ~/git/HogeSampleProject (develop)
$

developにmasterを取り込んでおく(忘れがち)

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git merge master
Merge made by the 'recursive' strategy.

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git log
commit e03477b2046f24976c7a15a97e9d1af67312626b
Merge: ed5be13 d4cf8de
Author: fuga@HogePC <tarou.fuga@hoge.com>
Date:   Wed Dec 3 17:12:22 2014 +0900

    Merge branch 'master' into develop

commit d4cf8ded26e4e04f5dd8884a751844e883d8e268
Author: P13002 <P13002@95ca04d6-2a50-f641-9c15-0b33580292c1>
Date:   Wed Dec 3 08:07:27 2014 +0000

    add README.md

    git-svn-id: http://hoge.com/repos/HogeSampleRepo/trunk/HogeSampleProject@16865 95ca04d6-2a50-f641-9c15-0b33580292c1

commit ed5be13a04b08051991c2517452e2a568dcff5ca
Merge: 0f27690 99cece6
Author: fuga@HogePC <tarou.fuga@hoge.com>
Date:   Wed Dec 3 16:57:13 2014 +0900

    Merge branch 'feature/myfeat1' into myfeat1_work1

commit 99cece6e00f05ff0c579d3e8e0d81f81e2bea3ba
Author: G14077 <G14077@95ca04d6-2a50-f641-9c15-0b33580292c1>
:

(重要)Gitリポジトリ管理者は、Gitリモートリポジトリのほうにも、PUSHする(SVNへのコミットのあとにGitにPUSH)

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git push origin develop:develop
Counting objects: 2, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (2/2), 482 bytes | 0 bytes/s, done.
Total 2 (delta 0), reused 0 (delta 0)
To git@192.168.xxx.xxx:team1/HogeSampleProject.git
   99cece6..e03477b  develop -> develop

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git push origin master:master
Total 0 (delta 0), reused 0 (delta 0)
To git@192.168.xxx.xxx:team1/HogeSampleProject.git
   99cece6..d4cf8de  master -> master

fuga@HogePC ~/git/HogeSampleProject (develop)
$

Gitリポジトリ管理者は、メンバーに周知する

※Chatで周知
http://192.168.xxx.xxx:88/team1/HogeSampleProject/wall

TeamBの開発者のルーチン的な開発作業

<TeamBの開発者>

  1. 各開発者は自分のfeatureに最新のdevelopを取り込む
  2. 同様にして、ワークブランチにも取り込んでおく
  3. 開発者は、自分の開発を続行~繰り返す

各開発者は自分のfeatureに最新のdevelopを取り込む

fuga@HogePC ~/git/HogeSampleProject (develop)
$ git checkout feature/myfeat1
Switched to branch 'feature/myfeat1'

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git merge origin/develop
Updating ed5be13..e03477b
Fast-forward

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$

同様にして、ワークブランチにも取り込んでおく

fuga@HogePC ~/git/HogeSampleProject (feature/myfeat1)
$ git checkout myfeat1_work1
Switched to branch 'myfeat1_work1'

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$ git merge feature/myfeat1
Updating ed5be13..e03477b
Fast-forward

fuga@HogePC ~/git/HogeSampleProject (myfeat1_work1)
$

開発者は、自分の開発を続行~繰り返す

18
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
23