"你在上午会议中"是什么意思?

ozb*_*bek 12 git gerrit

当我跑步时git status,这就是我所看到的:

$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

    modified:   xxx
    modified:   xxx
    modified:   xxx

Untracked files:
  (use "git add <file>..." to include in what will be committed)

    xxx

no changes added to commit (use "git add" and/or "git commit -a")

$ git version
git version 1.9.1
Run Code Online (Sandbox Code Playgroud)

那么,那个git试图告诉我什么以及解决它的正确方法是什么?

我不知道这是否相关,但我们使用,所有更改都经过审核/审批流程.

Von*_*onC 8

解决冲突

做一个git diff,看看你是否有任何合并标记,如:

$ git diff hello.txt
diff --cc hello.txt
index 5eb9649,379bd44..0000000
--- a/hello.txt
+++ b/hello.txt
@@@ -1,1 -1,1 +1,7 @@@
++<<<<<<< HEAD
 +Hello, master change.
++||||||| merged common ancestors
++Hello, Original.
++=======
+ Hello, branch b1 change.
++>>>>>>> b1
Run Code Online (Sandbox Code Playgroud)

如果没有,尝试并重新git am-3选项:git am -3

如果你有,做,例如使用kdiff3(Windows或Linux) git mergetool --tool=kdiff3.这将启动一个图形工具,允许您在本地,基础和远程之间进行选择

+--------------------------------+
| BASE   |    LOCAL     | REMOTE |
+--------------------------------+
|             MERGED             |
+--------------------------------+
Run Code Online (Sandbox Code Playgroud)

http://tedfelix.com/software/git-mergetool-kdiff3.png

附:

  • LOCAL:包含当前分支上文件内容的临时文件.
  • BASE:包含合并公共基础的临时文件.
  • REMOTE:包含要合并的文件内容的临时文件.
  • MERGED:包含冲突标记的文件.

git am --continue只应在git的状态没有报告任何不分级的文件.

通过Ted Felix的Git Conflict Resolution了解更多信息:它有这个方便的摘要:

  1. 始终使用" -3"和" git am"来确保您获得冲突标记.
  2. 使用" git status"和" git diff"来找出问题所在.
  3. 通过以下任何方法解决冲突:
    • 使用您喜欢的编辑器编辑每个冲突的文件.
    • " git checkout --theirs"或" git checkout --ours".
    • " git checkout -m"撤消特定文件的冲突解决方案.(小心!)
    • " git mergetool"和适当的合并GUI工具之类的kdiff3.
  4. " git add"已解决的文件.
  5. " git am --continue"继续上午.

使用Git 2.17(2018年第二季度),不要忘记启动你的git am会话,git am --show-current-patch以便更好地查看在发生冲突时编辑的路径.
请参阅" 显示当前git交互式rebase操作 ".