Git错误集合

本文介绍了在使用Git过程中遇到的一些常见问题及其解决方案,包括分支分歧、预提交错误及rebase过程中的冲突解决办法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、Your branch and ‘origin/yh_branch’ have diverged

2、npm run -s precommit (node v8.9.3)

3、You are currently rebasing branch ‘yh_branch’ on ‘d6e7f13’.

———————————————————————————————

1、Your branch and ‘origin/yh_branch’ have diverged

huideMacBook-Pro:graph huiyu$ git status
On branch yh_branch
Your branch and ‘origin/yh_branch’ have diverged,
and have 52 and 1 different commits each, respectively.
(use “git pull” to merge the remote branch into yours)

解决步骤:
参考:https://stackoverflow.com/questions/2452226/master-branch-and-origin-master-have-diverged-how-to-undiverge-branches
1、git merge origin/yh_branch(将线上分支merge下来)
2、解决冲突
3、提交

2、npm run -s precommit (node v8.9.3)

huideMacBook-Pro:graph huiyu$ git commit -m “更新代码”
husky > npm run -s precommit (node v8.9.3)

fatal: Not a git repository: ‘.git’

husky > pre-commit hook failed (add –no-verify to bypass)

解决:
git commit -m “更新代码” -n

3、You are currently rebasing branch ‘yh_branch’ on ‘d6e7f13’.

问题:
huideMacBook-Pro:graph huiyu$ git status
rebase in progress; onto d6e7f13
You are currently rebasing branch ‘yh_branch’ on ‘d6e7f13’.
(all conflicts fixed: run “git rebase –continue”)

nothing to commit, working tree clean
huideMacBook-Pro:graph huiyu$ git branch
* (no branch, rebasing yh_branch)

解决:
使用【 git diff 】命令,查看有冲突的文件,【自己解决文件冲突】或者【使用idea中revert】,当所有冲突解决完毕,最后使用git rebase –continue命令或者git rebase –skip命令。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

辉哥大数据

你的鼓舞将是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值