File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
shell/git-tools/commit/revert Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 33# author : Android 轮子哥
44# github : https://github.com/getActivity/AndroidCmdTools
55# time : 2026/01/25
6- # desc : Git 重置到提交脚本(硬重置到指定 commit)
6+ # desc : Git 重置提交脚本
77# ----------------------------------------------------------------------
88scriptDirPath=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd)
99[ -z " " ] || source " ../../../common/SystemPlatform.sh"
@@ -82,10 +82,10 @@ main() {
8282 fi
8383 exit 0
8484 elif [[ " ${resultChoice} " == " 2" ]]; then
85- (cd " ${repositoryDirPath} " && git reset --hard " ${origHead} " )
85+ (cd " ${repositoryDirPath} " && git reset --hard " ${origHead} " ) < /dev/null > /dev/null
8686 finalHash=$( cd " ${repositoryDirPath} " && git rev-parse HEAD)
8787 if [[ " ${finalHash} " == " ${origHead} " ]]; then
88- (cd " ${repositoryDirPath} " && git branch -D " ${backupBranch} " ) 2>&1 || true
88+ (cd " ${repositoryDirPath} " && git branch -D " ${backupBranch} " ) < /dev/null > /dev/null || true
8989 echo " ✅ 已经还原到最初的状态,并已删除备份分支 ${backupBranch} "
9090 exit 0
9191 else
You can’t perform that action at this time.
0 commit comments