Git/Error

来自康健生活
< Git
Kangkk​(留言 | 贡献)2024年2月29日 (四) 11:08的版本 (创建页面,内容为“ == error == * Automatic merge failed; fix conflicts and then commit the result. : {{shc_out|<syntaxhighlight lang="bash"> git status</syntaxhighlight>|<syntaxhighlight lang="text"> On branch newsearch Your branch is up to date with 'origin/newsearch'. You have unmerged paths. (fix conflicts and run "git commit") (use "git merge --abort" to abort the merge) Changes to be committed: new file: .babelrc modified: .eslintignore mo…”)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

error

  • Automatic merge failed; fix conflicts and then commit the result.
[jian@kang /home/kwy]$
git status
On branch newsearch
Your branch is up to date with 'origin/newsearch'.

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Changes to be committed:

        new file:   .babelrc
        modified:   .eslintignore
        modified:   api/consult.js
        modified:   api/prepose.js
        new file:   assets/img/search/collect-2.png
...
Unmerged paths:
  (use "git add <file>..." to mark resolution)

        both modified:   README.md
        both modified:   api/conf.js
        both added:      api/search.js
...
1. 丢弃本地分支内容,本地的内容将会被丢弃,慎用
 
git reset --hard origin/mergesearch
或者
 
git reset --hard ORIG_HEAD # 慎用
2. 合并以后的文件内容混乱,废弃此次合并,回到合并之前的状态
 
git reset --hard HEAD
  • error: Merging is not possible because you have unmerged files.
 
git diff
git status
  • fatal: cannot do a partial commit during a merge.
git 认为有部分代码没有做好提交的准备
[jian@kang /home/kwy]$
git commit -a
  GNU nano 2.9.3                                       /mnt/d/gitee/***-**-pc/.git/COMMIT_EDITMSG                                                 
Merge branch 'newsearch' of gitee.com:bjzyxc/ask-go-pc into newsearch

# Conflicts:
#       README.md
#       api/conf.js
#       api/search.js
#       components/common/header/index.vue
#       config/env.js
#       layouts/search.vue
#       pages/search.vue
#       pages/search/list.vue
#       pages/search/listLeftArticle.vue
#       pages/search/listLeftUser.vue
#       pages/search/listRight.vue
#       pages/search/navmenu.vue
#       plugins/bus.js
#       plugins/router.js
#       server/index.js
#
# It looks like you may be committing a merge.
# If this is not correct, please remove the file
#       .git/MERGE_HEAD
# and try again.

                                                                [ Read 115 lines ]
^G Get Help     ^O Write Out    ^W Where Is     ^K Cut Text     ^J Justify      ^C Cur Pos      M-U Undo        M-A Mark Text   M-] To Bracket
^X Exit         ^R Read File    ^\ Replace      ^U Uncut Text   ^T To Spell     ^_ Go To Line   M-E Redo        M-6 Copy Text   M-W WhereIs Next
  • It looks like you may be committing a merge. # If this is not correct, please remove the file
  • remote: Enumerating objects: 1, done.
    remote: Counting objects: 100% (1/1), done.
    remote: Total 1 (delta 0), reused 0 (delta 0)
    Unpacking objects: 100% (1/1), done.
    From w.src.corp.qihoo.net:design/dome
       e99cf03..86a552c  master     -> origin/master
    error: cannot lock ref 'refs/remotes/origin/test': Unable to create '/mnt/d/360/demo/.git/refs/remotes/origin/test.lock': File exists.
    
    Another git process seems to be running in this repository, e.g.
    an editor opened by 'git commit'. Please make sure all processes
    are terminated then try again. If it still fails, a git process
    may have crashed in this repository earlier:
    remove the file manually to continue.
     ! f15b60c..0bacea2  test       -> origin/test  (unable to update local ref)
    
  • ! [rejected] fixWebLabel -> fixWebLabel (non-fast-forward)
/home/kangkk
git pull --rebase origin fixWebLabel
git push -u origin fixWebLabel
  • error: pathspec 'yy-dev' did not match any file(s) known to git
先检查分支 git branch -a
  • 未完成合并(MERGE_HEAD存在)
/home/kangkk
git merge --abort
git reset --merge
git pull