git不同的仓库合并

在更换电脑并新建本地Git仓库后,尝试与原有远程仓库关联时遇到无法pull或push的问题。通过网上搜索,了解到不能直接合并,并尝试使用`git push --force`命令强行合并,使得本地仓库包含远程文件。然而,本地独有的文件并未自动推送到远程仓库,需要手动push以保持两者同步。

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

不同的仓库合并

git关联远程仓库上遇到的小问题
换了电脑新建的本地仓库并没有clone,后来想和原本git上的仓库关联后发现不能pull也不能push
提示

hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before 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.

根据提示和网上的回答用了
git config pull.rebase false
git pull
除了443连不上GitHub以外报了
fatal: refusing to merge unrelated histories
拒绝合并不相关的历史,
rebase是用来使log看起来更直观的一种合并,这里不适用具体以后再

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值