Files
codefever/doc/en-us/git/merge_branch.md
Carney Wu d3de96487f initial version (#1)
* fix(Useless Code): remove useless code

* feat(Deploy Scripts): add deploy scripts

* fix(Delopy Script): change settings

* fix(Deploy Script): fix ssh-keygen script

* fix(Deploy Script): change env file path

* feat(Deploy Script): add db migration

* fix(Deploy script): change script

* feat(Deploy Script): add sql file to create database

* fix(Deploy Script): add composer support

* fix(Deploy Script): add composer

* fix(Service Script): add http gateway

* fix(Deploy Script): add git path

* fix(Deploy Script): fix setting bugs

* fix(Init Script): get user from config

* fix(Service): adjust run users

* feat(Doc): add doc

* fix(Doc): change docs

* fix(Deploy script): change owner of storage path

* feat: codefever-community documentation system

* fix(Doc): doc details page style

* feat: fix page navigation

* fix(SQL File): fix db file fit MySQL 5.7

* fix(FileTree): empty repository display

* fix: fix helper navigation

* docs(zh-cn essential part):

* fix(Doc Style): change markdown.css

* docs(contribution doc):

* fix: unified page style

* docs(Readme): add readme

* build(Build):

Co-authored-by: cubic <carneywu@pgyer.com>
Co-authored-by: pololi <pololi@pgyer.com>
Co-authored-by: yangchen <chenyang@pgyer.com>
2022-01-19 17:21:59 +08:00

2.3 KiB

本地的分支合并

CodeFever 上合并分支时,会遇到合并冲突的情况,目前 CodeFever 暂时不支持在线解决冲突,可以使用下面的流程完成冲突情况下的分支合并。这些流程不局限于解决冲突,也可以作为正常合并分支的流程。

同仓库内的分支合并

在同一个仓库内,在 CodeFever 上从 <source branch> 分支往 <target branch> 分支合并时需要在本地进行同仓库内的分支合并

同仓库内的分支合并操作步骤:

  1. 在本地,先切换工作目录到分支 <target branch>,例如:

    git checkout <target branch>
    
  2. 合并 <source branch> 的改动到当前分支 <target branch>,例如:

    git merge <source branch>
    
  3. 修改有冲突的文件,解决冲突

  4. 创建新提交

    git add <changed files>
    git commit -m 'memo'
    
  5. 将解决冲突的改动推送到远程仓库

    git push <remote name> <target branch>
    

不同仓库间进行分支合并

CodeFever 上,从 <source repo> 仓库的 <source branch> 分支往 <target repo> 仓库的 <target branch> 分支合并时,如果遇到冲突需要在本地进行不同仓库间进行分支合并

本地解决不同分支合并步骤:

  1. <target repo> 的本地仓库内,切换工作目录到分支 <target branch>

    git checkout <target branch>
    
  2. 为本地的 <target repo> 仓库添加远程仓库 <source repo>

    > git remote add  <source repo name> <source repo>
    
  3. 拉取远程仓库分支 <source repo> 的改动

    git fetch <source repo name> <source branch>
    
  4. 合并 <source repo name>/<source branch> 的改动到当前分支 <target branch>

    git fetch <source repo name>/<source branch>
    
  5. 修改有冲突的文件,解决合并冲突

  6. 创建新提交

    git add <changed files>
    git commit -m 'memo'
    
  7. 将解决冲突的改动推送到远程仓库 <target branch>

    git push <target remote name> <target branch>
    
  8. 删除远程仓库 (可选)

    git remote remove <source remote name>
    

参照: Git 常用命令参考