项目一般性git操作流程
背景
基于github或者gitee上下载的代码,需要做二次开发,需要上传代码
到自己的gitee或者github工程,需做本文事项。
对本地的项目Check
1、git remote -v,查看当前工程关联的远端工程
2、git branch -r 查看当前工程关联的远端工程对应远端分支
3、git branch 查看本地分支
在gitee/github上建立自己的工程
获得https://gitee.com/yxxx/yyyy.git这样的git工程url
关联远端工程
git remote add origin+复制出来的仓库的HTTPS链接,若提示远端工程源存在,
则需要删除后,重新添加。
git remote rm origin
将远端代码拉到本地
git pull origin master。
提示fatal: refusing originto merge unrelated histories
则执行git pull origin master --allow-unrelated-histories
若提示Automatic merge failed; fix conflicts and then commit the result.
通过git status 查看冲突的文件,自动修复活手动修复
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and m ake a commit.