代码之家  ›  专栏  ›  技术社区  ›  Syntax Error ine

Gitlab分支在合并两个分支后“分叉”

  •  1
  • Syntax Error ine  · 技术社区  · 6 年前

    我有一个分支叫 refactor ,我合并到 master ,使用Gitlab web界面。这也删除了源分支。

    回到壳里,我注意到git仍然认为它在壳上 重构 分支(不再存在)。我试着把树枝换回去 主人 但我在本地做了一些进一步的工作,导致了未保存的更改。我发现一个新的命令叫做 stash

    $ git stash
    warning: LF will be replaced by CRLF in Prec/EnquiryForms/wizard/manifest.xml
    The file will have its original line endings in your working directory.
    Saved working directory and index state WIP on refactor: 3b174f5 Updated package
    

    主人

    $ git checkout master
    Switched to branch 'master'
    Your branch is up to date with 'origin/master'.
    

    我试着申请藏匿,但有冲突

    $ git stash apply
    Auto-merging Prec/Scripts/_wizard/manifest.xml
    CONFLICT (content): Merge conflict in Prec/Scripts/_wizard/manifest.xml
    Auto-merging Prec/EnquiryForms/wizard/manifest.xml
    CONFLICT (content): Merge conflict in Prec/EnquiryForms/wizard/manifest.xml
    Auto-merging Prec/Prec.Manifest.xml
    CONFLICT (content): Merge conflict in Prec/Prec.Manifest.xml
    

    所以我还是试着去做,但现在被卡住了。

    $ git status
    On branch master
    Your branch is up to date with 'origin/master'.
    
    Unmerged paths:
      (use "git reset HEAD <file>..." to unstage)
      (use "git add <file>..." to mark resolution)
    
            both modified:   Prec/Prec.Manifest.xml
            both modified:   Prec/EnquiryForms/wizard/manifest.xml
            both modified:   Prec/Scripts/_wizard/manifest.xml
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            Prec/Lookups/CLTYPES/
    
    no changes added to commit (use "git add" and/or "git commit -a")
    
    
    $ git stash list
    stash@{0}: WIP on refactor: 3b174f5 Updated package
    
    
    $ git add .
    
    
    $ git commit -m "some changes"
    [master d5892a6] some changes
     4 files changed, 112 insertions(+)
     create mode 100644 Prec/Lookups/CLTYPES/manifest.xml
    
    
    $ git push origin master
    To gitlab.example.com:repo/new.git
     ! [rejected]        master -> master (fetch first)
    error: failed to push some refs to 'git@gitlab.example.com:repo/new.git'
    hint: Updates were rejected because the remote contains work that you do
    hint: not have locally. This is usually caused by another repository pushing
    hint: to the same ref. You may want to first integrate the remote changes
    hint: (e.g., 'git pull ...') before pushing again.
    hint: See the 'Note about fast-forwards' in 'git push --help' for details.
    

    git pull

    $ git pull
    remote: Enumerating objects: 1, done.
    remote: Counting objects: 100% (1/1), done.
    remote: Total 1 (delta 0), reused 1 (delta 0)
    Unpacking objects: 100% (1/1), done.
    From gitlab.example.com:repo/new-coi
       c521196..bce53c1  master     -> origin/master
    Auto-merging Prec/Scripts/_wizard/manifest.xml
    CONFLICT (content): Merge conflict in Prec/Scripts/_wizard/manifest.xml
    Auto-merging Prec/EnquiryForms/wizard/manifest.xml
    CONFLICT (content): Merge conflict in Prec/EnquiryForms/wizard/manifest.xml
    Auto-merging Prec/Prec.Manifest.xml
    CONFLICT (content): Merge conflict in Prec/Prec.Manifest.xml
    Automatic merge failed; fix conflicts and then commit the result.
    

    我现在的状态如下

    $ git status
    On branch master
    Your branch and 'origin/master' have diverged,
    and have 1 and 5 different commits each, respectively.
      (use "git pull" to merge the remote branch into yours)
    

    1 回复  |  直到 6 年前
        1
  •  1
  •   S.K.    6 年前

    从主控形状中提取更改后,您的更改与推入主控形状中的某些更改发生冲突(当您处理更改时)。Git无法合并更改本身,希望您解决冲突,然后再次推送。

    以下是解决冲突并再次推送到远程回购的步骤: Resolve Merge Conflicts using command line