Skip to content

Instantly share code, notes, and snippets.

@hrysd
Created September 1, 2012 17:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrysd/3581444 to your computer and use it in GitHub Desktop.
Save hrysd/3581444 to your computer and use it in GitHub Desktop.
pull request

pull request しましょう。

基本的な流れ

Github 上で fork する

# git clone repo
# cd repo

作業用のbranch を作り、切り替える(基本的にmasterはいじらない)

# git checkout -b new_feature
# なにかをする。
# git commit -m "add new function"

fork した自分のリポジトリにpush

# git push origin new_feature

pull request!!!

さらに...

####作業中にもmasterは変化する。 # git remote add upstream git://hogehoge

おおもとの変化を pull する

# git pull upstream master

自分が作成した brach にまぜる

# git rebase master

conflict したらなおす。

# なおす。
# git add .
# git rebase --continue

commit をまとめる

最新からn個前のコミットをまとめる場合

# git rebase -i HEAD~n

エディタに以下のようなぶんが出てくる。
pick 0000000 commit message1
pick 0000001 commit message2
pick 0000002 commit message3

ここでは、commitをまとめたり、commit messageの編集、 まとめるcommit まとめない commit の選択、 順序の入れ替えができる。今回はまとめるだけ。

pick 0000000 commit message1
fixup 0000001 commit message2
fixup 0000002 commit message3

こうすれば 0000000 のコミットにまとめられる。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment