[Git] GitHub: 実録! pull request (後編)

本家のリポジトリが更新されている。
その後、ローカルでも開発を進めた想定。

Contents

状況

add_omnigraffle-pro5_spike というトピックブランチを作成しました。

% git branch
  add_firefox-ja
* add_omnigraffle-pro5_spike
  master

add_firefox-ja を確認のため merge しました。

% git log
* 57dccdb - (11 minutes ago) added omnigraffle pro 5 - DriftwoodJP (HEAD, origin
* c85d2b5 - (7 days ago) added Firefox for Japanese - DriftwoodJP (origin/master
*   9a03118 - (8 days ago) Merge pull request #178 from chrishas35/patch-1 - Mic

元のプロジェクトの更新を反映する

本家リポジトリの更新を取り込む

% git checkout master
Switched to branch 'master'
Your branch is up-to-date with 'origin/master'.
% git fetch upstream
remote: Counting objects: 81, done.
remote: Compressing objects: 100% (46/46), done.
remote: Total 67 (delta 37), reused 49 (delta 21)
Unpacking objects: 100% (67/67), done.
From github.com:caskroom/homebrew-versions
   9a03118..0fd2c3d  master     -> upstream/master

本家リポジトリの変更を比較確認する。

% git diff upstream/master
diff --git a/Casks/firefox-beta-cn.rb b/Casks/firefox-beta-cn.rb
deleted file mode 100644
index 00e2558..0000000
--- a/Casks/firefox-beta-cn.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class FirefoxBetaCn < Cask
-  url 'https://download.mozilla.org/?product=firefox-29.0b2&os=osx&lang=zh-CN'
-  homepage 'https://www.mozilla.org/zh-CN/firefox/beta/'
-  version '29.0b2'
-  sha256 '9ed32e46990d9f16139c31002a4fd93739dec401c9c6cb518c1a0bf78ee0f435'
-  link 'Firefox.app'
-end
diff --git a/Casks/firefox-cn.rb b/Casks/firefox-cn.rb

mastermerge します。

% git merge upstream/master
Updating c85d2b5..0fd2c3d
Fast-forward
 Casks/firefox-beta-cn.rb        | 7 +++++++
 Casks/firefox-cn.rb             | 7 +++++++
 Casks/flux-beta.rb              | 5 +++++
 Casks/keepassx0.rb              | 7 +++++++
 Casks/keepassx2.rb              | 7 -------
 Casks/messenger-for-telegram.rb | 7 -------
 Casks/rubymine-eap.rb           | 6 +++---
 firefox-esr-us.rb               | 7 +++++++
 8 files changed, 36 insertions(+), 17 deletions(-)
 create mode 100644 Casks/firefox-beta-cn.rb
 create mode 100644 Casks/firefox-cn.rb
 create mode 100644 Casks/keepassx0.rb
 delete mode 100644 Casks/keepassx2.rb
 delete mode 100644 Casks/messenger-for-telegram.rb
 create mode 100644 firefox-esr-us.rb

同期・rebase した内容をリモートに push する

% git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 24 commits.
  (use "git push" to publish your local commits)
% git push origin master
Counting objects: 81, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (67/67), done.
Writing objects: 100% (67/67), 11.40 KiB | 0 bytes/s, done.
Total 67 (delta 34), reused 0 (delta 0)
To git@github.com:DriftwoodJP/homebrew-versions.git
   c85d2b5..0fd2c3d  master -> master

トピックブランチを削除する

プルリクエスト用のトピックブランチを削除する

% git branch -d add_firefox-ja
Deleted branch add_firefox-ja (was 0fd2c3d).
% git push --delete origin add_firefox-ja
To git@github.com:DriftwoodJP/homebrew-versions.git
 - [deleted]         add_firefox-ja

pull request 用に commit を1つにまとめる

開発を進めた add_omnigraffle-pro5_spike をまとめ、プルリクエスト用のブランチを作成します。

% git checkout add_omnigraffle-pro5_spike
Switched to branch 'add_omnigraffle-pro5_spike'
Your branch is based on 'origin/add_omnigraffle-pro5_spike', but the upstream is gone.
  (use "git branch --unset-upstream" to fixup)
% git checkout -b add_omnigraffle-pro5
Switched to a new branch 'add_omnigraffle-pro5'
% git rebase -i master
Successfully rebased and updated refs/heads/add_omnigraffle-pro5.

変更した点は以下で確認できます。

% git diff master add_omnigraffle-pro5
diff --git a/Casks/omnigraffle-pro5.rb b/Casks/omnigraffle-pro5.rb
new file mode 100644
index 0000000..20aa28c
--- /dev/null
+++ b/Casks/omnigraffle-pro5.rb
@@ -0,0 +1,7 @@
+class OmnigrafflePro5 < Cask
+  url 'http://www.omnigroup.com/ftp/pub/software/MacOSX/10.6/OmniGrafflePro-5.4
+  homepage 'http://www.omnigroup.com/products/omnigraffle'
+  version '5.4.4'
+  no_checksum
+  link 'OmniGraffle Professional 5.app'
+end

pull request する

% git push origin add_omnigraffle-pro5
Counting objects: 6, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 523 bytes | 0 bytes/s, done.
Total 4 (delta 2), reused 0 (delta 0)
To git@github.com:DriftwoodJP/homebrew-versions.git
 * [new branch]      add_omnigraffle-pro5 -> add_omnigraffle-pro5

以下略。

手を動かすと分かってくる。