Skip to content
This repository has been archived by the owner on Aug 15, 2023. It is now read-only.

更新代码遇到 data/db/*.json 冲突(files would be overwritten by merge) #138

Open
Arondight opened this issue Sep 23, 2021 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@Arondight
Copy link
Owner

这个冲突在提交 02f7bec 中引入,但是我觉得是必要的,在这个提交之后数据文件就不影响仓库了。但是引入的问题是,当使用的代码比 02f7bec 更早时,更新代码会遇到以下报错。

Updating 982e96d..02f7bec
error: Your local changes to the following files would be overwritten by merge:
        data/db/aby.json
        data/db/artifact.json
        data/db/authority.json
        data/db/character.json
        data/db/cookies.json
        data/db/gacha.json
        data/db/info.json
        data/db/map.json
        data/db/music.json
        data/db/time.json
Please commit your changes or stash them before you merge.
Aborting

你需要把 ./data/db/*.json 移动到一个备份目录,更新后再移动回来。

npm run stop
mkdir /tmp/bot-data/ && mv -vf ./data/db/*.json /tmp/bot-data/
git pull -p
cp -vf /tmp/bot-data/*.json ./data/db/
npm install
npm run start

这个错误只需要解决一次,之后就不会有了。

你可以参考 #116 来定时备份数据目录,避免误操作造成数据丢失。

@Arondight Arondight added the documentation Improvements or additions to documentation label Sep 23, 2021
@Arondight

This comment has been minimized.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant