Git branch(分支)

作者: 7c03aed0f01f | 来源:发表于2016-11-29 10:50 被阅读90次

分支

将routes.php 回退到上一个版本

git checkout -- app/Http/routes.php

添加一个分支 about-feature

分支通常用于修改Bug, 或其他新增、修改操作, 然后经技术主管审核后 合并到 master

git branch about-feature

查看目前有哪些分支

git branch

切换分支

git checkout about-feature

输出

Switched to branch 'about-feature'

添加分支, 并进入分支

git checkout -b about-feature

在分支完成修改操作, 切换到 master 下, 合并分支

git merge about-feature

完成合并分支后, 可以删除旧分支

git branch -d about-feature

解决冲突

合并分支的时候, Git 会提示某些文件 存在冲突

Auto-merging index.php
CONFLICT(content): Merge conflict in index.php
Automatic merge failed; fix conflicts and then commit the result.

通过命令, 查看冲突文件

git diff index.php

删除冲突的部分(你觉得不需要的部分)

<<<<<<< HEAD    //master 分支的代码
    Laravel 5 Master
=======         // about-feature 分支的代码
    Laravel 5 New Design
>>>>>>> about-feature

重新 add index.php文件代码, 然后commit

相关文章

  • Git命令学习

    分支 git branch : 查看分支git branch : 创建分支git branch -d...

  • Git分支详解

    Git分支详解 git branch命令 查看分支 git branch 新建分支 git branch br...

  • git branch分支

    创建分支 git branch test 查看分支 git branch git branch -a 推送分支 g...

  • GIT 分支管理

    查看远程分支 git branch -a 查看本地分支 git branch 创建分支 git branch br...

  • Git命令记录

    查看本地分支git branch 查看所有分支git branch -a 新建分支git branch (cust...

  • git常用命令

    查看本地分支git branch查看远程分支git branch -a删除本地分支git branch -d [分...

  • 创建 合并 分支

    查看分支:git branch 创建分支:git branch 切换分支:git checkout ...

  • 分支

    查看分支:git branch 创建分支:git branch 切换分支:git checkout ...

  • git 合并拉取分支

    查看分支:git branch 创建分支:git branch 切换分支:git checkout ...

  • git教程 分支管理

    查看分支 git branch 创建分支 git branch 切换分支 git checkout ...

网友评论

    本文标题:Git branch(分支)

    本文链接:https://www.haomeiwen.com/subject/qfuapttx.html