首页 > 其他 > 详细

git管理命令

时间:2019-11-09 11:16:22      阅读:93      评论:0      收藏:0      [点我收藏+]

# 克隆代码到本地 > git clone https://github.com/yangjianbo/test_project

#查看代码更新
> git status

#
把所要条件的代码提交给git去管理
>git add test.py

#
提交代码,本地提交版本提交
> git commit -m "提交代码" (提交代码,本地提交)
#提交到远程仓库

> git push origin master (提交到远程仓库)

#分支管理项目
#查看当前分支
> git branch -l 

#创建分支
> git branch xxx 

#切换分支
> git checkout xxx

#合并分支(合并分支,把dev分支的合并到master分支)
> git merge dev

代码冲突解决:
如果A开发改动了test.py代码,B开发也改动了test.py这个文件的代码
就会导致文件冲突
> git pull (拉取代码的时候有冲突)
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/yjbtest/test_dev
d206c2d..eb13c49 master -> origin/master
error: Your local changes to the following files would be overwritten by merge:
test.py
Please commit your changes or stash them before you merge.
Aborting
首先提交有冲突的文件
> git add test.py
> git commit -m "A开发的修改"
然后解决冲突
> vim test.py (解决有冲突的文件)
> git add test.py (提交到git)
> git commit -m "A和B商量后的共同修改" (本地提交)
> git push origin master (提交到远程仓库)



git管理命令

原文:https://www.cnblogs.com/QAyangjianbo/p/11824540.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!