Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/email/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gitlab分支机构';分歧';合并两个分支后_Git_Gitlab - Fatal编程技术网

Gitlab分支机构';分歧';合并两个分支后

Gitlab分支机构';分歧';合并两个分支后,git,gitlab,Git,Gitlab,我有一个分支叫做refactor,我使用Gitlab web界面将它合并到master。这也删除了源分支 回到shell中,我注意到git仍然认为它位于refactor分支上(该分支已不存在)。我尝试将分支切换回master,但我在本地做了一些进一步的工作,导致未保存的更改。我发现了一个新的(对我来说)命令,名为stash,因此尝试: $ git stash warning: LF will be replaced by CRLF in Prec/EnquiryForms/wizard/mani

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

回到shell中,我注意到git仍然认为它位于
refactor
分支上(该分支已不存在)。我尝试将分支切换回
master
,但我在本地做了一些进一步的工作,导致未保存的更改。我发现了一个新的(对我来说)命令,名为
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
然后我可以切换到
master

$ 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 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)

我真的不明白这里发生了什么,也不知道如何修复它。我基本上希望合并分支后所做的更改被提交到主分支中。Git需要和我的本地目录一样是最新的

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

以下是解决冲突,然后再次推送到远程回购的步骤:

$ 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)