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相关常用 ...
 
随机推荐
- SQLAlchemy表操作和增删改查
			
一.SQLAlchemy介绍 SQLAlchemy是一个基于Python实现的ORM框架.该框架建立在 DB API之上,使用关系对象映射进行数据库操作,简言之便是:将类和对象转换成SQL,然后使用数 ...
 - Wing ide 6.0 注册 ,python 3.6环境
			
直接切入主题,套路如下: 1.选择手动输入license license number输入:CN123-12345-12345-12345 2.在下一步中,选择第二项,拷贝的request code ...
 - Machine Learning - week 4 - 编程练习
			
= X' * (h - y) LrCostFunction 与上一周的有什么不同? 与 week3 的 costFunctionReg 是一样的.Week3 中参考答案没有排除 theta 第一行,但 ...
 - 学习SpirngMVC之如何获取请求参数
			
学习SpringMVC——如何获取请求参数 @RequestParam,你一定见过:@PathVariable,你肯定也知道:@QueryParam,你怎么会不晓得?!还有你熟悉的他(@Cooki ...
 - Git分支-分支简介
			
源地址:https://git-scm.com/book/zh/ch3-1.html 几乎所有的版本控制系统都以某种形式支持分支. 使用分支意味着你可以把你的工作从开发主线上分离开来,以免影响开发主线 ...
 - 51 Nod 1028 大数乘法 V2【Java大数乱搞】
			
1028 大数乘法 V2 基准时间限制:2 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 给出2个大整数A,B,计算A*B的结果. Input 第1行:大数A 第2行:大数B (A ...
 - 51Nod 1090 3个数和为0(暴力)
			
1090 3个数和为0 基准时间限制:1 秒 空间限制:131072 KB 分值: 5 难度:1级算法题 给出一个长度为N的无序数组,数组中的元素为整数,有正有负包括0,并互不相等.从 ...
 - 51nod1649- 齐头并进-最短路
			
1649 齐头并进 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 在一个叫奥斯汀的城市,有n个小镇(从1到n编号),这些小镇通过 ...
 - JPQL
			
JPQL语言 JPQL语言,即 Java Persistence Query Language 的简称. JPQL是一种和 SQL 非常类似的中间性和对象化查询语言, 它最终会被编译成针对不同底层数据 ...
 - ceph-deploy出错UnableToResolveError Unable to resolve host
			
背景 ps:在本文中,假设我系统的hostname为node1. 使用ceph-deploy命令搭建Ceph集群,执行ceph new node1时,出现如下错误: [node1][INFO ] Ru ...