如果是自己的 git,沒有跟人家 sync..(或是還沒sync).
那就可以用 ...
git reset --hard ed2b7f3501f6這樣,用 git log 看,最後會在 commit ed2b7f3501f6 的地方。
這個 commit 後面的都不見了,,
git reset --hard ed2b7f3501f6這樣,用 git log 看,最後會在 commit ed2b7f3501f6 的地方。
.git/hooks/prepare-commit-msg
#!/bin/sh if test -r "checkpatch.pl"; then git diff --cached | ./checkpatch.pl --no-signoff --no-tree - fi檢查project 目錄是不是有 checkpatch.pl 好決定是不是要 執行
! grep -qs "\[NO_STYLE_CHECK\]" "$1" || exit 0就可以在 commit 時,加入 "[NO_STYLE_CHECK]" bypass 掉 checkpatch:
$ git commit -am "[NO_STYLE_CHECK] try commit dirty codes"
#!/bin/sh # # pre-commit hook to run check-patch on the output and stop any commits # that do not pass. Note, only for git-commit, and not for any of the # other scenarios # # Copyright 2010 Ben Dooks,if git rev-parse --verify HEAD 2>/dev/null >/dev/null then against=HEAD else # Initial commit: diff against an empty tree object against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 fi git diff --cached $against -- | ./scripts/checkpatch.pl --no-signoff -
$ git revert COMMIT-SHA
git log commit A ... commit B ... commit C ..就要反過來:
git revert A git revert B git revert C