自学内容网 自学内容网

sourcetree中常用功能使用方法及gitlab冲突解决

  • 添加至缓存:等于git add

在这里插入图片描述

  • 提交:等于git commit

![s(https://i-blog.csdnimg.cn/direct/fe4bba3a9a434389a73c4c70d7b43c40.png)

  • 拉取/获取:等于git pull ,在每次要新增代码或者提交代码前需要先拉取一遍服务器中最新的代码,防止服务器有其他人更新了代码,但我们自己本地的代码在我们更新前跟服务器不一致导致会出现冲突
    在这里插入图片描述
  • 合并分支:当多个人一起开发时,我们不能直接在master直接去做开发这样会导致master的代码会出现混乱,所以需要创建一些测试分支用来我们拉取开发后再合并到master,所以一般都是会先切到测试分支进行开发然后再合并到master
    在这里插入图片描述
  • 推送:等于git push ,在每次提交代码后通过推送本地代码推送到gitlab服务器

在这里插入图片描述

  • 当存在冲突时,大部分是本地的代码没有同步服务器最新的代码,但此时你本地又有一些变更这个时候提交或者拉取都会出现冲突,这时候要先把你本地变更的文件先添加到缓存,然后再拉取一遍服务器最新的代码,拉取后再确认你本地的代码是否要推送到服务器上
git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags origin main:main
POST git-receive-pack (487 bytes)
remote: GitLab: You are not allowed to push code to protected branches on this project.
Pushing to http://xxxx:8010/root/fenmi_api_frame.git
To http://xxxx:8010/root/fenmi_api_frame.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'http://xxx/root/fenmi_api_frame.git'

原文地址:https://blog.csdn.net/weixin_42760923/article/details/140567580

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!