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相关常用 ...
随机推荐
- Redis随笔(一)Linux Redis 搭建
1.到官网下载redis上传服务器或者使用wget 下载 wget redis下载的路径 2.查看linux是否安装编译环境gcc,没有先安装 yum -y install gcc 3.解压redis ...
- Beyond Globally Optimal: Focused Learning
这里对WWW 2017文章<Beyond Globally Optimal: Focused Learning for Improved Recommendations>进行一个简单的分析 ...
- cs231n spring 2017 lecture9 CNN Architectures 听课笔记
参考<deeplearning.ai 卷积神经网络 Week 2 听课笔记>. 1. AlexNet(Krizhevsky et al. 2012),8层网络. 学会计算每一层的输出的sh ...
- HDU--2011
多项式求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- 94、存储库之MongoDB、mysql
本篇导航: 简介 MongoDB基础知识 安装 基本数据类型 CRUD操作 其它 存储库之mysql 一.简介 MongoDB是一款强大.灵活.且易于扩展的通用型数据库1.易用性 MongoDB是 ...
- c#版 K线控件(Stock)
K线起源于日本米市交易,它的基本用途就是为了寻找"买卖点".股市及期货市场中的K线图的画法包含四个数据,即开盘价.最高价.最低价.收盘价,所有的k线都是围绕这四个数据展开,反映大势 ...
- js函数声明的三种方式
1.直接声明 function box(num1,num2){ return num1+num2;}alert(box(1,2)); 2.使用变量初始化 var box2 = function(num ...
- 在jquery中防止ajax重复提交
- 初识Spider_Man(爬爬虫)
一:引子
- radiobutton独特属性
radiobutton是通过name来分组的,也就是说,使用相同的名字的radio,它们才是单选的,如果名字不同的radio,是不具备这个效果的,这个是第一要点. 第二,针对不同的radio(name ...