temporaryなめも帳

だらだらと備忘録とか。誰かの為になることをねがって。

git repo系 - cmd memo

branch名

$ git branch -m <changed name>
$ git branch -m <target branch> <changed name>

repo間の差分

$ repo forall -p -c git diff android-4.4.1_r1..android-4.4.1_r2

ファイルの差分を追う

$ git log --follow -p <target path>

他のブランチのファイル参照

$ git show <branch name>:<path_to_file>

他のブランチのcommitを取り込む

$ git log <other branch name>
$ git cherry-pick <commit hash>

もしコンフリクトしたら、

$ git add <修正ファイル>
$ git commit -c <commit hash>

もしくは、

$ git mergetool

cherry-pickした時にcommitしない

一部とかのみを拾いたい時に

$ git cherry-pick -rn <commit hash>

サーバーの特定ブランチに対してpushする

$ git push origin <local_branch_name>:<server_branch_name>

stagingされているファイルの差分表示

普通のdiffだと表示できない。

$ git diff --cached

git rm を使わずにファイルを消してしまった時に

status叩くとdeleted:がいっぱい出て困る。 一つづつgit rmしてられない。

$ git add --update