Git cheat sheet: Difference between revisions
Jump to navigation
Jump to search
Line 48: | Line 48: | ||
そいつを git clone |
そいつを git clone |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
現在のブランチを確認すること |
|||
<syntaxhighlight lang="bash" enclose="div"> |
<syntaxhighlight lang="bash" enclose="div"> |
||
git checkout master |
|||
git checkout -b 作業内容がよく分かるブランチ名 |
git checkout -b 作業内容がよく分かるブランチ名 |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
Line 64: | Line 66: | ||
git branch -d 作業内容がよく分かるブランチ名 |
git branch -d 作業内容がよく分かるブランチ名 |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
マージされなっかった作業ブランチを消す |
|||
<syntaxhighlight lang="bash" enclose="div"> |
|||
git branch -D 作業内容がよく分かるブランチ名 |
|||
</syntaxhighlight> |
|||
元のリポジトリのコミットを追いかける |
元のリポジトリのコミットを追いかける |
Revision as of 23:27, 11 May 2016
基本操作
github で repository つくったら手順がでてくる
mkdir hoge
cd hoge
git init
touch README.md
git add README.md
git commit -m 'first commit'
git remote add origin git@github.com:fuga/hoge.git
git push -u origin master
編集後
git add README.md
git commit -m 'message here'
git push
rename
git mv README.md README
git commit -m 'message here'
git push
fork して放置したリポジトリを元のリポジトリと合わせる
git pull 元のリポジトリ master
git push
ブランチを切る
git checkout -b my_new_branch
ブランチを push
git push origin my_new_branch
プルリクエストのパターン
github上でfork
そいつを git clone
現在のブランチを確認すること
git checkout master
git checkout -b 作業内容がよく分かるブランチ名
変更を加えてコミット
git push origin 作業内容がよく分かるブランチ名
github上でプルリクエスト
無事マージされたら作業ブランチを消す
git branch -d 作業内容がよく分かるブランチ名
マージされなっかった作業ブランチを消す
git branch -D 作業内容がよく分かるブランチ名
元のリポジトリのコミットを追いかける
git remote add upstream 元のリポジトリ
git checkout master
git pull upstream master
git checkout 作業ブランチ
git rebase master 作業ブランチ