git revert all changes


点击打开链接https://www.kernel.org/pub/software/scm/git/docs/git-reset.html


# Revert changes to modified files.
git reset --hard

# Remove all untracked files and directories.
git clean -fd


单个文件回滚至某一个sha1 id的commit:

git reset 3d0d7869580f8b55e2b0059e59a9698bd390fa1e -- app/models/hide_model.php

整个branch往前回滚至某一个sha1 id:

#往前一个版本回滚
git reset --hard HEAD^
#往指定的sha1 id回滚
git reset --hard [sha1 id]
#还可以软回滚,只更改本地branch,不修改history
git reset --soft [sha1 id]
#or
git reset --soft HEAD^


posted @ 2013-08-02 10:19  lein.wang  Views(629)  Comments(0Edit  收藏  举报