Git亲历常见错误【待更新】

1.Please specify which branch you want to merge with.

使用git pull的时候多次碰见下面的情况:

There is no tracking information for the current branch.
Please specify which branch you want to merge with.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> release

使用git在本地新建一个分支后,需要做远程分支关联。如果没有关联,git会在下面的操作中提示你显示的添加关联。

关联目的是在执行git pull, git push操作时就不需要指定对应的远程分支,你只要没有显示指定,git pull的时候,就会提示你。

解决方案:

git branch --set-upstream-to=origin/remote_branch  your_branch
//remote_branch用远程仓库的分支替换,your_branch用你自己本地仓库的分支替换
//git branch --set-upstream不再适用了,要用git branch --set-upstream-to

2. fatal: refusing to merge unrelated histories

问题1建立了关联后,merge、pull和push的时候会碰到,这是因为两个分支还没有关联的历史记录,因此需要加一句unrelated histories

解决方案

git merge main--allow-unrelated-histories
//或者 git pull origin main --allow-unrelated-histories
//哦对了,差点被别人的误导了,现在2023年基本都是main,没有叫master(主人)的了
//Spurred by the rise in racism cases across the US, GitHub recently renamed its 'master' branch to 'main'.

其他常见问题和解决方案:

1.在 Markdown 中插入图片

https://www.jianshu.com/p/ad61a4535767

2.使用Github+picGo搭建图床

https://zhuanlan.zhihu.com/p/489236769

3.Git LFS

//跳过smudge
git lfs install --skip-smudge

git clone ...

// 取二进制文件
git lfs pull

// 恢复smudge
git lfs install --force
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值