Git 流れ やり直し 削除

サーバ

[server]$ mkdir repos.git
[server]$ cd repos.git
[server]$ git --bare init --share

クライアント

ローカルレポジトリを作り変更を繰り返す
[local]$ git init
[local]$ git add .  <-ここでトラックするべきファイルをレポジトリに追加する。
[local]$ git commit
または纏めて
[local]$ git commit -a

リモートレポジトリ(メインのレポジトリ)を変更
[local]$ git push ssh://user@server.com/~/.../repos.git master
ただし、リモートレポジトリが空(初期状態のまま)の時は最初の一回だけ
[local]$ git push -u ssh://user@server.com/~/.../repos.git master

リモートレポジトリのアドレスを何回も入れるのが面倒な時は
[local]$ git remote add origin ssh://user@server.com/~/.../repos.git (origin以外でもref名は何でも良い)
を1回やっておけば次回は
[local]$ git push origin master

コミットログを見たい
[local/server]$ git log

コミットの詳細を確認したい
[local/server]$ git show <コミットのNo.>

ローカル編集を消したい。
[local/server]$git checkout  ディレクトリを指定すれば、再帰的にcheckoutしてくれる。

コミットを辞めたい/削除したい/uncommitしたい
[local/server]$ git reset --soft
[local/server]$ git reset --soft HEAD^

リモート削除したい/uncommitしたい
[local/server]$ git reset --hard
[local/server]$ git reset HEAD~
[local/server]$ git push -f
WARNING This is changing history and if there are others that have pulled from the repo, it will cause trouble. This should not be a normal workflow for undoing changes on a remote branch, you should use git revert.




ーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーーー

ローカルのリセットの結果をリモートに反映する
[local/server]$ git remote prune origin
x [deleted] (none) -> origin/hoge


http://keyamb.hatenablog.com/entry/2013/02/08/105556