7,166
edits
(→実用編) |
(→実用編) |
||
(6 intermediate revisions by the same user not shown) | |||
Line 134: | Line 134: | ||
# セーブ | # セーブ | ||
git push -f | git push -f | ||
# こちらが安全なのかな git push --force-with-lease | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 148: | Line 149: | ||
git rebase --continue | git rebase --continue | ||
git push -f | git push -f | ||
# こちらが安全なのかな git push --force-with-lease | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 175: | Line 177: | ||
git checkout -b new_branch upstream/new_branch | git checkout -b new_branch upstream/new_branch | ||
git push -u origin new_branch | git push -u origin new_branch | ||
</syntaxhighlight> | |||
いわゆる backport | |||
<syntaxhighlight lang="bash" enclose="div"> | |||
git checkout 対象ブランチ | |||
git checkout -b 修正用ブランチ名 | |||
git cherry-pick -x <commit_hash> | |||
git push -u origin 修正用ブランチ名 | |||
# そして PR | |||
</syntaxhighlight> | |||
複数のcherrypick。注意点は開始点の指定が一つ前になるので直感的でなく、そのために"^"をつける癖をつけたほうがよい。 | |||
<syntaxhighlight lang="bash" enclose="div"> | |||
git log --oneline | |||
git cherry-pick -x {COMMIT-A}^..{COMMIT-Z} | |||
</syntaxhighlight> | |||
作業ミスして upstream と強制同期 | |||
<syntaxhighlight lang="bash" enclose="div"> | |||
git fetch upstream | |||
git reset --hard upstream/master | |||
</syntaxhighlight> | |||
タグ名でブランチ作成 | |||
<syntaxhighlight lang="bash" enclose="div"> | |||
git tag | |||
git checkout -b 新ブランチ名 refs/tags/タグ名 | |||
</syntaxhighlight> | </syntaxhighlight> |