Git分支管理[三]
标签(linux): git
笔者Q:972581034 交流群:605799367。有任何疑问可与笔者或加群交流
git分支管理命令
git branch #创建分支
git branch -v #详细显示创建过程
git branch -merged #查看已融合过的分支
git branch --no-merged #查看哪些分支没有被融合
git branch -d testing #删除分支
git checkout #切换分支
git merge #融合分支
git log
git stash #做一个暂存区
git tag #打标记
创建一个分支
[root@git test]# git branch about
[root@git test]# git branch
about
* master
查看状态可发现还在master
[root@git test]# git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
news.html
pay.html
nothing added to commit but untracked files present (use "git add" to track)
切换到about分支
[root@git test]# git checkout about
Switched to branch 'about'
[root@git test]# git status
On branch about
Untracked files:
(use "git add <file>..." to include in what will be committed)
news.html
pay.html
nothing added to commit but untracked files present (use "git add" to track)
验证分支是否创建成功
[root@git test]# echo "about us" > about.html
[root@git test]# git add .
[root@git test]# git commit -m "about"
[about 2390a21] about
3 files changed, 3 insertions(+)
create mode 100644 about.html
create mode 100644 news.html
create mode 100644 pay.html
[root@git test]# git log
commit 2390a21f03a22ab4c9ae81de0736e1e9bbcdbebf
Author: chentiangang <chentiangang@yoho8.com>
Date: Fri Aug 18 00:16:36 2017 +0800
about
commit 145b100cd0e07a9e59e15cf71aad3338ed8a57a6
Author: chentiangang <chentiangang@yoho8.com>
Date: Thu Aug 17 23:42:32 2017 +0800
index.html
切回到master分支查看
[root@git test]# git log
commit 2390a21f03a22ab4c9ae81de0736e1e9bbcdbebf
Author: chentiangang <chentiangang@yoho8.com>
Date: Fri Aug 18 00:16:36 2017 +0800
about
commit 145b100cd0e07a9e59e15cf71aad3338ed8a57a6
Author: chentiangang <chentiangang@yoho8.com>
Date: Thu Aug 17 23:42:32 2017 +0800
index.html
[root@git test]# git checkout master
Switched to branch 'master'
[root@git test]# git log
commit 1cf6888d97b0a361a3daed01a06c67936bc4f241
Author: chentiangang <chentiangang@yoho8.com>
Date: Thu Aug 17 23:49:27 2017 +0800
first index:v2
commit 145b100cd0e07a9e59e15cf71aad3338ed8a57a6
Author: chentiangang <chentiangang@yoho8.com>
Date: Thu Aug 17 23:42:32 2017 +0800
index.html
融合分支
* 注意:如果是master想跟about融合,需要先切换到master然后执行命令
[root@git test]# git merge about
Merge branch 'about'
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
~
".git/MERGE_MSG" 7L, 248C written
Merge made by the 'recursive' strategy.
about.html | 1 +
about2.html | 1 +
news.html | 1 +
pay.html | 1 +
4 files changed, 4 insertions(+)
create mode 100644 about.html
create mode 100644 about2.html
create mode 100644 news.html
create mode 100644 pay.html

Git分支管理[三]的更多相关文章
- Git 分支管理是一门艺术
转载: Git 分支管理是一门艺术 1 要确保:团队成员从主分支(master)获得的都是处于可发布状态的代码,而从开发分支(develop)应该总能够获得最新开发进展的代码. 2 "辅助分 ...
- git分支管理与冲突解决(转载)
Git 分支管理和冲突解决 原文:http://www.cnblogs.com/mengdd/p/3585038.html 创建分支 git branch 没有参数,显示本地版本库中所有的本地分支名称 ...
- 团队项目的Git分支管理规范
原文地址: http://blog.jboost.cn/2019/06/17/git-branch.html 许多公司的开发团队都采用Git来做代码版本控制.如何有效地协同开发人员之间,以及开发.测试 ...
- Git工程开发实践(四)——Git分支管理策略
A successful Git branching model https://nvie.com/posts/a-successful-git-branching-model/ Git工程开发实践( ...
- 在Visual Studio 中使用git——分支管理-下(九)
在Visual Studio 中使用git--什么是Git(一) 在Visual Studio 中使用git--给Visual Studio安装 git插件(二) 在Visual Studio 中使用 ...
- Git 分支管理策略汇总
原文链接: Git 分支管理策略 最近,团队新入职了一些小伙伴,在开发过程中,他们问我 Git 分支是如何管理的,以及应该怎么提交代码? 我大概说了一些规则,但仔细想来,好像也并没有形成一个清晰规范的 ...
- GIT分支管理模型
GIT分支管理模型 link: git-branching-model 主分支(Main branches) 项目两个常驻分支: master 主干分支(锁定),仅用于发布新版本,平时不能在上面干活, ...
- Git 分支管理详解
大纲: 1.前言 2.创建分支 3.切换分支 4.合并分支(快速合并) 5.删除分支 6.分支合并冲突 7.合并分支(普通合并) 8.分支管理策略 9.团队多人开发协作 10.总结 注,测试机 Cen ...
- Git—分支管理
Git—分支管理 分支学习:branch称为分支,默认仅有一个名为master的分支.一般开发新功能流程为:开发新功能时会在分支dev上进行,开发完毕后再合并到master分支. branch相关常用 ...
随机推荐
- 关于python使用threadpool中的函数单个参数和多个参数用法举例
1.对单个元素的函数使用线程池: # encoding:utf-8 __author__='xijun.gong' import threadpool def func(name): print 'h ...
- github免密登陆
import requests import re # 一:先获取登陆页面,拿到authenticity_token: # 1 请求的url:https://github.com/login # 2 ...
- 如何给网站添加SSL证书(免费)
上篇讲了如何将网站部署到服务器上,这篇就讲如何给网站添加SSL证书. 1.先到腾讯云ssl证书认证那里申请一个证书 2.DNS认证 3.下载解压nginx里面的文件 4. 在服务器上/www目录下创建 ...
- 2017ecjtu-summer training #6 Gym 100952D
D. Time to go back time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- win10系统下如何用命令行的方式打开画图软件
按 win + r 后输入命令 mspaint 再 回车 即可!如下图所示:
- 在64位系统下,指向int型的指针占的内存空间多大?
不废话,请看代码演示如下: 注意使用的操作系统的位数,不同位数的操作系统,结果不一样! 我是用的是64位的操作系统! linux下示例代码如下: #include <stdio.h> in ...
- EMC题2
易安信笔试题分享:1 protected成员函数能被肿么调用2 “has-a” relationship是指的啥,答案有instance, reference, pointer等...3 int, c ...
- LinkedHashMap 源码详细分析(JDK1.8)
1. 概述 LinkedHashMap 继承自 HashMap,在 HashMap 基础上,通过维护一条双向链表,解决了 HashMap 不能随时保持遍历顺序和插入顺序一致的问题.除此之外,Linke ...
- Git的简单的基本使用
前言: 接触了Android Studio,自然是知道了Github这个网站,这个网站有许多大神们做的开源库,我们只需要简单地引入就是可以使用到这些开源库从而实现酷炫的效果,最近也是刚接触到Git的使 ...
- Laravel5中使用阿里大于(鱼)发送短信验证码
在做用户注册和个人中心的安全管理时,我实现借助第三方短信平台(阿里大于(鱼))在Laravel框架中进行手机验证的设置:阿里大于,是阿里通信旗下优质便捷的云通信服务平台,整合了三大运营商的通信能力,为 ...