首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Git重基-重新创建命令的结果(yarn.lock文件等)

Git重基-重新创建命令的结果(yarn.lock文件等)
EN

Stack Overflow用户
提问于 2022-08-02 04:55:22
回答 2查看 51关注 0票数 2

获取此错误:

代码语言:javascript
运行
复制
Executing: git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
yarn install v1.22.19
[1/5]   Validating package.json...
[2/5]   Resolving packages...
[3/5]   Fetching packages...
[4/5]   Linking dependencies...
[5/5]   Building fresh packages...
success Saved lockfile.
✨  Done in 10.29s.
error: could not open '/Users/devinrhode2/repos/myco/tess1/.git/worktrees/tess3/rebase-merge/author-script' for reading: No such file or directory
error: you have staged changes in your working tree
If these changes are meant to be squashed into the previous commit, run:

  git commit --amend 

If they are meant to go into a new commit, run:

  git commit 

In both cases, once you're done, continue with:

  git rebase --continue

error: could not commit staged changes.
error: cannot rebase: Your index contains uncommitted changes.
warning: execution failed: git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
and made changes to the index and/or the working tree
You can fix the problem, and then run

  git rebase --continue


hint: Could not execute the todo command
hint: 
hint:     exec git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git rebase --continue
hint: 
hint: It has been rescheduled; To edit the command before continuing, please
hint: edit the todo list first:
hint: 
hint:     git rebase --edit-todo
hint:     git rebase --continue

我所要做的事情的精神实质上是从上一次提交(但在新的基础上)重新生成对yarn.lock文件的更改。简单地重新生成更改比验证更改容易得多。

EN

Stack Overflow用户

发布于 2022-08-02 14:57:16

@Johan

看起来这个重基食谱看起来可能是这样:

代码语言:javascript
运行
复制
pick 6a33e8ebe Run `yarn add eslint --dev`
exec LAST_MSG=$(git log -1 --format=%B 6a33e8ebe); git reset --soft HEAD~ && git restore --staged yarn.lock && git restore yarn.lock && yarn install && git add yarn.lock && git commit -m "$LAST_MSG"

当然,为LAST_MSG实际获取散列的复杂性--我认为应该能够引用HEAD tho。

UPDATE:实际上,理想的模式是命令有自己的单独提交,并执行:

代码语言:javascript
运行
复制
drop bde6f678a Run `yarn prettier --write README.md .eslintrc.js`
exec yarn prettier --write README.md .eslintrc.js && git commit -am "Run `yarn prettier --write README.md .eslintrc.js`"

Git可能应该引入一个提交消息语法,如:

代码语言:javascript
运行
复制
git commit -am "exec! yarn prettier --write README.md .eslintrc.js"

当重新建立基础时,它基本上会扩展到以下方面:

代码语言:javascript
运行
复制
drop bde6f678a Run `yarn prettier --write README.md .eslintrc.js`
exec yarn prettier --write README.md .eslintrc.js && git commit -am "exec! yarn prettier --write README.md .eslintrc.js"

提交永远都不可能足够小!

票数 0
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73202146

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档