Skip to content

Instantly share code, notes, and snippets.

@hiroyuki-sato
Created February 2, 2012 04:46
Show Gist options
  • Save hiroyuki-sato/1721557 to your computer and use it in GitHub Desktop.
Save hiroyuki-sato/1721557 to your computer and use it in GitHub Desktop.
1, オリジナルソースの取得
% git clone https://github.com/syoyo/node.rdma.git
Cloning into node.rdma...
remote: Counting objects: 54, done.
remote: Compressing objects: 100% (40/40), done.
remote: Total 54 (delta 23), reused 41 (delta 10)
Unpacking objects: 100% (54/54), done.
hsato-mbp:tmp hsato$
hsato-mbp:tmp hsato$ cd node.rdma/
2, 現在のブランチ
% git branch
* master
3, 作業用のブランチを作成
% git checkout -b hiro_test
Switched to a new branch 'hiro_test'
4, 現在のブランチ確認
* がついているのが現在のブランチ
% git branch
* hiro_test
master
5, ソースの編集 (1回目)
% vi rdma_wrap.cc
オリジナルソースに次の文字列を追加
// sample comment add1
6, 差分の確認(パッチ生成)
% git diff rdma_wrap.cc
diff --git a/rdma_wrap.cc b/rdma_wrap.cc
index 6696b00..2f31eb1 100644
--- a/rdma_wrap.cc
+++ b/rdma_wrap.cc
@@ -570,3 +570,5 @@ private:
extern "C" {
NODE_MODULE(rdma, RDMA::Initialize);
}
+
+// sample comment add1
7, コミット(1回目)
% git commit -m 'add first sample comment' .
[hiro_test a2e2a2e] add first sample comment
1 files changed, 2 insertions(+), 0 deletions(-)
8, ソースの編集(2回目)
% vi rdma_wrap.cc
オリジナルソースに次の文字列を追加
// sample comment add2
9, コミット1回目と現在編集中のデータとの差分
% git diff rdma_wrap.cc
diff --git a/rdma_wrap.cc b/rdma_wrap.cc
index 2f31eb1..391cead 100644
--- a/rdma_wrap.cc
+++ b/rdma_wrap.cc
@@ -572,3 +572,4 @@ NODE_MODULE(rdma, RDMA::Initialize);
}
// sample comment add1
+// sample comment add2
10, コミット(2回目)
% git commit -m 'add second sample comment' .
[hiro_test 96081c4] add second sample comment
1 files changed, 1 insertions(+), 0 deletions(-)
11, 変更履歴の確認
% git log
commit 96081c4d8bd04ce2f3544c92bb5df13cd58eea80 <-- 2回目のコミット
Author: Hiroyuki Sato <hiro@email.hidden>
Date: Thu Feb 2 13:30:37 2012 +0900
add second sample comment
commit a2e2a2ede4b04314c2abb5b2f65982da16af51de <-- 1回目のコミット
Author: Hiroyuki Sato <hiro@email.hidden>
Date: Thu Feb 2 13:29:13 2012 +0900
add first sample comment
commit 1d460e09cec97b29570fb37ec11f8175cefc3e43 <-- オリジナル
Author: Syoyo Fujita <syoyo@email.hidden>
Date: Wed Feb 1 00:32:46 2012 +0900
Cosmetic fix.
12, オリジナルと、2回目の差分パッチ作成
commit時のハッシュ値を引数で指定する。
8文字程度あれば、一意にできるためハッシュ値を全部指定する必要はない
% git diff -u 1d460e09 96081c4d
diff --git a/rdma_wrap.cc b/rdma_wrap.cc
index 6696b00..391cead 100644
--- a/rdma_wrap.cc
+++ b/rdma_wrap.cc
@@ -570,3 +570,6 @@ private:
extern "C" {
NODE_MODULE(rdma, RDMA::Initialize);
}
+
+// sample comment add1
+// sample comment add2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment