博客
关于我
git版本管理系列(八)
阅读量:329 次
发布时间:2019-03-03

本文共 1206 字,大约阅读时间需要 4 分钟。

关联远程仓库,分为两种情况

本地已经有了仓库,远程也有了一个仓库

mkdir learngitcd learngitgit inittouch README.mdgit add README.mdgit commit -m "first commit"git remote add origin git@gitee.com:motain/learngit.gitgit push -u origin master

git remote add origin 个人的git地址

关联后,使用命令git push -u origin master第一次推送master分支的所有内容;

此后,每次本地提交后,只要有必要,就可以使用命令git push origin master推送最新修改;

 

创建分支

nelsen-mac:learngit mac$ git checkout -b dev

git checkout命令

nelsen-mac:learngit mac$ git add readme.md nelsen-mac:learngit mac$ git commit -m'add dev again'

加上-b参数表示创建并切换,相当于以下两条命令 

nelsen-mac:learngit mac$ git branch devnelsen-mac:learngit mac$ git checkout dev

列出所有分支,当前分支会有个*

nelsen-mac:learngit mac$ git branch* dev  master

 修改readme.md文件,并提交到仓库

nelsen-mac:learngit mac$ git add readme.md nelsen-mac:learngit mac$ git commit -m'add dev again'

 切换到master分支,此时master分支上没有dev上面修改的内容

nelsen-mac:learngit mac$ git checkout master

合并dev分支上的修改

nelsen-mac:learngit mac$ git merge devUpdating 79073fa..9a2a725Fast-forward    //这次合并是“快进模式”,也就是直接把master指向dev的当前提交,合并速度非常快。 readme.md | 1 + 1 file changed, 1 insertion(+)

此时master分支上出现了dev的修改内容,删除分支

nelsen-mac:learngit mac$ git branch -d devDeleted branch dev (was 9a2a725).nelsen-mac:learngit mac$ git branch* master

 

转载地址:http://lsyq.baihongyu.com/

你可能感兴趣的文章
nginx+mysql+redis+mongdb+rabbitmq 自动化部署脚本
查看>>
nginx+php的搭建
查看>>
nginx+tomcat+memcached
查看>>
Nginx+Tomcat实现动静分离
查看>>
nginx+Tomcat性能监控
查看>>
nginx+uwsgi+django
查看>>
nginx+vsftp搭建图片服务器
查看>>
Nginx-http-flv-module流媒体服务器搭建+模拟推流+flv.js在前端html和Vue中播放HTTP-FLV视频流
查看>>
nginx-vts + prometheus 监控nginx
查看>>
Nginx/Apache反向代理
查看>>
Nginx: 413 – Request Entity Too Large Error and Solution
查看>>
nginx: [emerg] getpwnam(“www”) failed 错误处理方法
查看>>
nginx: [emerg] the “ssl“ parameter requires ngx_http_ssl_module in /usr/local/nginx/conf/nginx.conf:
查看>>
nginx:Error ./configure: error: the HTTP rewrite module requires the PCRE library
查看>>
Nginx:objs/Makefile:432: recipe for target ‘objs/src/core/ngx_murmurhash.o‘解决方法
查看>>
Nginx、HAProxy、LVS
查看>>
Nginx下配置codeigniter框架方法
查看>>
Nginx中使用expires指令实现配置浏览器缓存
查看>>
nginx中配置root和alias的区别
查看>>
nginx主要流程(未完成)
查看>>