You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#仅参考,实际实现需要再次查询`git`官方资料#!/bin/bash
GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)if [ -z"$GIT_DIR" ];thenecho"Not a git repository"exit 1
fiif [ -f"$GIT_DIR/index.lock" ];thenecho"Commit in progress"elif [ -f"$GIT_DIR/MERGE_HEAD" ];thenecho"Merge in progress"elif [ -d"$GIT_DIR/rebase-apply" ];thenecho"Rebase in progress (rebase-apply)"elif [ -d"$GIT_DIR/rebase-merge" ];thenecho"Rebase in progress (rebase-merge)"elif [ -f"$GIT_DIR/rebase-merge/interactive" ];thenecho"Interactive rebase in progress"elif [ -f"$GIT_DIR/CHERRY_PICK_HEAD" ];thenecho"Cherry-pick in progress"elseecho"No operations in progress"fi
补充git日志
[STARTED] Preparing lint-staged...
[COMPLETED] Preparing lint-staged...
[STARTED] Hiding unstaged changes to partially staged files...
[COMPLETED] Hiding unstaged changes to partially staged files...
[STARTED] Running tasks for staged files...
[STARTED] package.json — 19 files
[STARTED] * — 19 files
[STARTED] eslint --fix
[FAILED] eslint --fix [FAILED]
[FAILED] eslint --fix [FAILED]
[COMPLETED] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Restoring unstaged changes to partially staged files...
[SKIPPED] Skipped because of errors from tasks.
[STARTED] Reverting to original state because of errors...
[FAILED] error: Your local changes to the following files would be overwritten by merge:
src/router/elegant/imports.ts
src/router/elegant/transform.ts
src/typings/elegant-router.d.ts
Please commit your changes or stash them before you merge.
Aborting
Index was not unstashed.
The text was updated successfully, but these errors were encountered:
症状
在进行【部分提交】时选中部分文件因为预提交检测失败直接从工作目录中消失了。需要手动恢复。
原因
在进行【部分提交】时会产生文件短暂的变动,
elegant-router
检测到文件变化立即去生成新的路由文件。而提交内容在预提交检测可能因为提交存在错误被拒绝,
ide
就需要恢复工作目录到提交前状态。由于
elegant-router
在提交中因为文件变化触发重新生成路由文件使得工作目录中的生成内容发生变化,直接后续的恢复冲突,恢复失败。建议
路由生成前请检测当前
git
的状态,提交中,合并中,变基中等时推迟生成,避免对当前工作目录产生不可控的干扰。以下是
gpt
给出的一些判断状态,我认为是需要考虑改进的,不是什么时刻都能立即进行生成的。补充
git
日志The text was updated successfully, but these errors were encountered: