LoginSignup
19
21

More than 5 years have passed since last update.

EC-CUBE3のメモ - GitHub/Git使い方 -

Last updated at Posted at 2015-03-24

EC-CUBE3をきっかけに、GitHub/Git使いはじめたけど、なかなか覚えられないのでメモ

とりあえずFork

とりあえず本家のレポジトリをフォークする

https://github.com/EC-CUBE/ec-cube で、右上のForkボタン押す。

次にclone

自分のレポジトリからcloneする
$ git clone https://github.com/ユーザ名/ec-cube.git

ブランチの状態を確認してみる

$ git branch -a
* master
remotes/origin/HEAD -> origin/master
remotes/origin/master

これでまずはソースコードをローカルに持ってきました

本家レポジトリの追従

本家が更新されても追従できるように、本家レポジトリをupstreamとして登録

$ git remote add upstream https://github.com/EC-CUBE/ec-cube.git
$ git remote -v
origin https://github.com/ユーザ名/ec-cube.git (fetch)
origin https://github.com/ユーザ名/ec-cube.git (push)
upstream https://github.com/EC-CUBE/ec-cube.git (fetch)
upstream https://github.com/EC-CUBE/ec-cube.git (push)

originには自分のが、upstreamには本家が登録されてるのがわかります。
この状態ではまだupstreamの情報を取得していないので一度fetchしておきます。
$ git fetch upstream

開発する時の流れ

ローカルに開発用ブランチを作成

$ git checkout -b ブランチ名 upstream/master

GitHubの自分のレポジトリに反映

$ git push origin ブランチ名

開発する

.
.
.

完了したらコミット

$ git add /path/to/file
$ git add /path/to/file
$ git commit -m "コメント"

本家の変更を確認

$ git fetch upstream
何か変更があればとってくる

本家の変更をマージ

$ git rebase upstream/master
何か変更があれば、マージする

コンフリクトした場合は、解消後、以下でマージを継続
$ git rebase --continue

自分のレポジトリにpush

$ git push origin ブランチ名 -f

プルリクを送る

GitHubの自分のレポトリから、PullRequestする

参考

19
21
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
19
21