Git

git push 报错:Updates were rejected because the remote contains work that you do

not have locally

git push To https://urlxxxxxxxxxxxxxx ! [rejected] xxxx -> xxxxx (fetch first) error: failed to push some refs to 'https://urlxxxxxxxxxxxxxx'

hint: Updates were rejected because the remote contains work that you do

hint: not have locally. This is usually caused by another repository pushing

hint: to the same ref. You may want to first integrate the remote changes

hint: (e.g., 'git pull ...') before pushing again.

hint: See the 'Note about fast-forwards' in 'git push --help' for details.

拉取更新

git pull origin xxxx 

拉取更新报错: You have divergent branches and need to specify how to reconcile them

git pull origin  branch_xxx
remote: Azure Repos
remote: Found 9 objects to send. (4 ms)
Unpacking objects: 100% (9/9), 850 bytes | 283.00 KiB/s, done.
From https://url_branch_xxxx
 * branch                    branch_xxxx -> FETCH_HEAD
   3c574a7f127..f8b99bb4d92  branch_xxxx -> origin/branch_xxxx
hint: You have divergent branches and need to specify how to reconcile them.
hint: You can do so by running one of the following commands sometime before
hint: your next pull:
hint:
hint:   git config pull.rebase false  # merge (the default strategy)
hint:   git config pull.rebase true   # rebase
hint:   git config pull.ff only       # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
fatal: Need to specify how to reconcile divergent branches.
使用合并(merge)

如果您希望在本地分支和远程分支之间进行合并,可以运行以下命令:

git config pull.rebase false

然后再次尝试 git pull

git pull origin branch_xxx

这种方法会保留所有的提交历史,并会生成一个新的合并提交。

使用重放(rebase)

如果您想要将本地的提交放置到远程分支的后面,从而拥有更整齐的提交历史,可以选择重放:

git config pull.rebase true

然后再次尝试 git pull

git pull origin  branch_xxx
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值