Branching and Merging

The Git feature that really makes it stand apart from nearly every other SCM out there is its branching model.

Git allows and encourages you to have multiple local branches that can be entirely independent of each other. The creation, merging, and deletion of those lines of development takes seconds.

This means that you can do things like:

  • Frictionless Context Switching. Create a branch to try out an idea, commit a few times, switch back to where you branched from, apply a patch, switch back to where you are experimenting, and merge it in.
  • Role-Based Codelines. Have a branch that always contains only what goes to production, another that you merge work into for testing, and several smaller ones for day to day work.
  • Feature Based Workflow. Create new branches for each new feature you're working on so you can seamlessly switch back and forth between them, then delete each branch when that feature gets merged into your main line.
  • Disposable Experimentation. Create a branch to experiment in, realize it's not going to work, and just delete it - abandoning the work—with nobody else ever seeing it (even if you've pushed other branches in the meantime).

Notably, when you push to a remote repository, you do not have to push all of your branches. You can choose to share just one of your branches, a few of them, or all of them. This tends to free people to try new ideas without worrying about having to plan how and when they are going to merge it in or share it with others.

There are ways to accomplish some of this with other systems, but the work involved is much more difficult and error-prone. Git makes this process incredibly easy and it changes the way most developers work when they learn it.

git 使用系列(二)---- 分支和合并的更多相关文章

  1. git 如何把master分支代码合并到自己的分支

    master分支的代码领先自己的分支,git 如何把master分支代码合并到自己的分支 1.首先切换到主分支 git checkout master 2.使用git pull 把领先的主分支代码pu ...

  2. Git学习系列 (二)

    #克隆目录并重命名为newname,默认目录名是使用.git前的grit git clone git://github.com/schacon/grit.git newname #将所有已经跟踪过的文 ...

  3. git学习4:分支管理

    每次提交,Git都把它们串成一条时间线,这条时间线就是一个分支.截止到目前,只有一条时间线,这个分支叫主分支,即master分支,HEAD指向master,master指向提交,所以,HEAD指向的就 ...

  4. 版本控制git之二 分支 切换分支 创建分支 合并 删除

      版本控制git之二 分支   有人把 Git 的分支模型称为它的`‘必杀技特性’',也正因为这一特性,使得 Git 从众多版本控制系统中脱颖而出. 为何 Git 的分支模型如此出众呢? Git 处 ...

  5. git使用笔记(二)分支与合并

    By francis_hao    Nov 18,2016 查看分支,* 表示当前所在分支 $ git branch 查看分支和最后一次提交记录 $ git branch -v 新建分支 $ git ...

  6. git 命令行(二)-创建合并分支

    1. 创建和合并分支 1. 我们创建 xu 分支,然后切换到 xu 分支: 2. 用 git branch 命令查看当前分支:    git branch命令会列出所有分支,当前分支前面会标一个*号. ...

  7. 小丁带你走进git的世界二-工作区暂存区分支

    小丁带你走进git的世界二-工作区暂存区分支 一.Git基本工作流程 1.初始化一个仓库 git  init git  clone git仓库分为两种情况: 第一种是在现有项目或目录下导入所有文件到 ...

  8. git分支的合并

    原文: http://gitbook.liuhui998.com/3_3.html http://gitbook.liuhui998.com/5_3.html 一.如何分支的合并 在git中,可以使用 ...

  9. Git知识总览(三) 分支的创建、删除、切换、合并以及冲突解决

    前两篇博客集中的聊了git的一些常用命令,具体请参见<Git知识总览(一) 从 git clone 和 git status 谈起>.<Git知识总览(二) git常用命令概览> ...

  10. Git系列二之数据管理

    1.Git基本管理 git常用的基本操作 1.1提交数据 我们可以简单的把工作目录理解成是一个被Git服务程序管理的目录,Git会时刻的追踪目录内文件的改动,另外在安装好了Git服务程序后,默认就会创 ...

随机推荐

  1. struts2防止重复提交的标签

    struts2 token 使用说明 --------------------------------------------------------------------------------- ...

  2. Java Swing 日期控件(转载)

    http://www.cnblogs.com/lzy1991/p/5714935.html

  3. android基础(一)

    wrap_conten:包裹实际文本内容 match_parent:当前控件铺满父类容器:2.3api之后添加的一个属性值 fill_parent:包裹实际文本内容,在2.3api之前的一个属性值 a ...

  4. 背包类问题解答——poj3624分析

    习题网址:http://poj.org/problem?id=3624 试题分析:该类题通过限定物品总数量.总质量:并且初始化每个物品的起始质量和一个量化的性质.最后求解最值的量化性质的值是多少的问题 ...

  5. mac下安装composer

    打开命令后 cd /usr/local/bin 然后执行 curl -sS https://getcomposer.org/installer | php 接下来 sudo mv composer.p ...

  6. 7、js使用正则表达式验证

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. 四、WCF的配置文件

    注:本文为学习摘抄,原文地址:http://www.cnblogs.com/iamlilinfeng/archive/2012/10/02/2710224.html 一.概述 配置也是WCF编程中的主 ...

  8. Java常用集合类(1)

    一.HashMap 参考文章: http://yikun.github.io/2015/04/01/Java-HashMap%E5%B7%A5%E4%BD%9C%E5%8E%9F%E7%90%86%E ...

  9. [转]整理jquery使用好习惯

    1.选择器Selector的使用 1)使用id定位性能最好   1.$("#id") 2)使用标签名定位,性能其次   1.$("p"),$("div ...

  10. chapter9_1 协同程序

    协同程序与线程差不多,也就是一条执行序列:有自己独立的栈.局部变量.指令指针,以及和其他协同程序共享的全局变量和其他大部分东西. 两者区别在于:一个多线程的程序可以同时运行几个线程,而协同程序却需要彼 ...