git合并远程分支

1.创建一个本地分支,并与远程分支建立联系:git checkout -b b origin/b

2.将远程代码pull到本地git pull origin b

报错:fatal:‘origin’ does not appear to be a git repository
fatal:Could not read from remote repository
原因:本地分支和远程分支断开连接
git fetch下拉所有分支
详情参照:https://blog.csdn.net/huanhuaqian/article/details/81986064

3.返回到你的分支a :git checkout a

4.合并分支a与分支b:git merge b

报错:git无法merge仓库refusing to merge unrelated histories
解决:在命令后面加: --allow-unrelated-histories
报错:git合并的时候,冲突问题Merging is not possible because you have unmerged files
解决:修改你的冲突的文件,修改完之后,保存。
用git add xxx,把你修改的文件全部都添加进去。
最后,用git commit -a -m ” 备注信息 ” 提交,完成。

5.把本地的分支a同步到远程: git push origin a

git push 成功,但是远程分支没有更新
git status 出现
On branch dev_master
Your branch is ahead of ‘origin/master’ by 4 commits.
(use “git push” to publish your local commits)

nothing to commit, working tree clean
git push出现
fatal: The upstream branch of your current branch does not match

the name of your current branch. To push to the upstream branch
on the remote, use

git push origin HEAD:master

To push to the branch of the same name on the remote, use

git push origin HEAD

To choose either option permanently, see push.default in ‘git help config’.

git push origin HEAD:master

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值