gitでコミットを取り消す

git commitしてから取り消したくなった。すべてを。

該当レポジトリ内で

git reset --hard <commit no>

で行けるらしい。でも<commit no>なんてわかりませんよ。

git log --oneline --graph

で左から二列目の現れる7桁の英数交じりの<commit no>を使えば、その時点まで戻ることができる。

[alias]
    graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short

~/.gitconfigにコピペしておけばgit graphでツリーがみられます。

コメント

このブログの人気の投稿

Inverse-normal transformation

SKAT

locuszoom