LoginSignup
3
2

More than 3 years have passed since last update.

【EC-CUBE4】②EC-CUBE本体の開発環境を整える(GitHub Flow編)

Last updated at Posted at 2019-07-31

EC-CUBE4の環境構築続きです。
【EC-CUBE4】①EC-CUBE本体の開発環境を整える(インストール編)

前提条件

方針

  • データベースはsqlite3を利用
  • webサーバーはビルドインウェブサーバーを利用。

構築手順

EC-CUBEがインストールされたディレクトリに移動する。

$ cd path/to/EC-CUBEがインストールされたディレクトリ

現在のブランチを確認します。EC-CUBEでは4.0ブランチがmasterブランチに相当します。

$ git branch -a
* 4.0
  remotes/origin/3.0
  remotes/origin/3.1
  remotes/origin/4.0
  remotes/origin/HEAD -> origin/4.0
  remotes/origin/co/master

リモートリポジトリを確認します。
cloneしてきたリポジトリのURLが表示されています。

$ git remote -v
origin  https://github.com/[GitHubUser(ご自身のアカウント)/ec-cube.git (fetch)
origin  https://github.com/[GitHubUser(ご自身のアカウント)/ec-cube.git (push)

EC-CUBE本家のリモートリポジトリをリモートに追加します。
https://github.com/EC-CUBE/ec-cube

$ git remote add upstream https://github.com/EC-CUBE/ec-cube.git

upstreamという名前で登録していますが、お好きな名前でOK
です。

登録されているかの確認をします。

$ git remote -v
origin  https://github.com/junpeko5/ec-cube.git (fetch)
origin  https://github.com/junpeko5/ec-cube.git (push)
upstream    https://github.com/EC-CUBE/ec-cube.git (fetch)
upstream    https://github.com/EC-CUBE/ec-cube.git (push)

4.0ブランチを本家からfetchします。

$ git fetch upstream 4.0
From https://github.com/EC-CUBE/ec-cube
 * branch                4.0        -> FETCH_HEAD
 * [new branch]          4.0        -> upstream/4.0

upstream/4.0のリモート追跡ブランチが作成されます。

最後に開発用の作業ブランチを本家のリモート追跡ブランチ(upstream/4.0)から切ります。

$ git checkout -b test-branch upstream/4.0
Branch 'test-branch' set up to track remote branch '4.0' from 'upstream'.
Switched to a new branch 'test-branch'

開発が終わったら、commitとpushをoriginにプッシュします。

$ git add /path/to/file
$ git commit -m "コメント"
$ git push origin test-branch

あとは、Githubの自分のリポジトリからプルリクエストを送れば完了です。
プルリクエストが送られた時点で、Travis CIのテストが自動的に実行されます。

下記URLは公式ドキュメントですが、わかりやすい図が載っていますので参考にしてみてください。
http://doc4.ec-cube.net/collaboration_githubflow

その他よく使用するgitコマンド

ローカルの4.0ブランチを最新にしたい場合

ローカルの4.0ブランチで

$ git pull upstream 4.0

を実行します。

不要になったローカルブランチを削除

$ git branch -D <削除したいbranch名>

不要になったリモートブランチを削除

$ git push --delete origin <削除したいリモートbranch名>

プルリクエストのブランチをチェックアウトする。

$ hub checkout <pullリクエストのURL>

例:$ hub checkout https://github.com/EC-CUBE/ec-cube/pull/4223

最後に

これでGitHub FlowでのEC-CUBE開発環境が整いました。
次回は【EC-CUBE4】③EC-CUBE本体の開発環境を整える(MYSQL,MailCatcher編)をお送りします。

3
2
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
3
2