久々にgithubを見たら、pull requestが来ていました。userstampのfork元が修正され、それに伴ってfork先にpull requestが発行されたようです。メール見てませんでした。
他の人の変更を取り込んだことが無かったので、Guides: Pull Requestsを見ながら差分をmergeしてみます。
まず、今回の変更が行われたリモートリポジトリを登録しようとしたところ、
1
2
|
$ git remote add -f korobkov git://github.com/korobkov/userstamp.git
fatal: Not a git repository |
と怒られてしまいました。以前作業したgitフォルダとは別のフォルダで作業しようとした為、.gitフォルダが無くてNGのようです。git initしないといけないらしい。
1
2
3
4
5
6
7
|
$ git init
Initialized empty Git repository in /home/masayuki/work/rails/tmp/test/.git/
$ ls -la
合計 12
drwxr-xr-x 3 masayuki dev 4096 2009-05-30 16:55 .
drwxr-xr-x 4 masayuki dev 4096 2009-05-30 16:55 ..
drwxr-xr-x 7 masayuki dev 4096 2009-05-30 16:55 .git |
.gitフォルダができました。remote addはうまくいったので、ファイルを取り込む為のbranchを作成します。
1
2
|
$ git checkout -b korobkov/master
fatal: ou are on a branch yet to be born |
また怒られてしまいました。READMEというファイルを作成しcommitした後、再度試してみると、
1
2
|
$ git checkout -b korobkov/master
Switched to a new branch "korobkov/master" |
うまくいきました。次に、先ほどのbranchにファイルを取り込もうとしたところ、
1
2
|
git pull korobkov master
fatal: empty ident not allowed |
またまた怒られてしまいました。configに、user.nameの指定が無かった(user.namaになっていた)為でした。
1
2
3
|
$ git config --global user.name "masayuki038"
$ git pull korobkov master
Automatic merge failed; fix conflicts and then commit the result. |
取り込めたものの、READMEファイルがconflictしました。修正して、
|
$ git commit -a -m"update merge" |
でコミット。
次に、以前forkして変更を加えたremoteリポジトリを登録します。この際、remoteリポジトリの場所にPublic Clone Urlを指定してしまうと、pushする際に、
1
2
|
$ git push origin master
You can't push to git://github.com/user/repo.git |
とエラーがでます。その為、remote addにはYour Clone Urlを指定します。
|
$ git remote add origin git@github.com:masayuki038/userstamp.git |
branchをmasterに切り替えます。
1
2
3
4
5
|
$ git branch
* korobkov/master
master
$git checkout master |
あとはmasterにpullし、branchにpullしたファイルをmergeします。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
$ git pull origin master
$ git merge korobkov/master
warning: refname 'korobkov/master' is ambiguous.
warning: refname 'korobkov/master' is ambiguous.
Auto-merged README
Merge made by recursive.
README | 8 ++--
lib/stampable.rb | 54 ++++++++++++++++--------------
test/compatibility_stamping_test.rb | 2 +-
test/helpers/functional_test_helper.rb | 10 +++--
test/helpers/unit_test_helper.rb | 58 ++++++++++++++++---------------
test/stamping_test.rb | 2 +-
test/userstamp_controller_test.rb | 24 +++++++------
7 files changed, 84 insertions(+), 74 deletions(-) |
自動的にcommitされるらしく、リモートリポジトリにpushして完了です。
1
2
3
4
5
6
7
|
$ git push origin master
Counting objects: 50, done.
Compressing objects: 100% (22/22), done.
Writing objects: 100% (38/38), 7.78 KiB, done.
Total 38 (delta 21), reused 25 (delta 14)
To git@github.com:masayuki038/userstamp.git
af36e03..7df7841 master -> master |
Sorry, comments are closed for this article.