What does “You are in the middle of an am session” mean?

前端 未结 3 1168
执笔经年
执笔经年 2021-01-04 06:39

When I run git status, this is what I am seeing:

$ git status
On branch master
Your branch is ahead of \'origin/master\' by 1 commit.
  (use \"g         


        
3条回答
  •  旧时难觅i
    2021-01-04 07:20

    What happened is that some file in working tree was changed, and committed prior AM session began (AM is a way to apply patches from email messages where email is split to changes and author info and then applied as a patch to repository).

    This is same as if you changed file, committed it, and then tried to merge change in same file in same lines based on old version. Git simply doesn't know which version of change is valid and therefore ends up in conflict state.

    These lines tell you that you have conflict:

    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)
    

    There are several ways to resolve this sort of conflicts, and all of them are manual. You need some 3-way merge tool (can google for it) that allows you to compare changes and choose the one you want to keep. vim editor AFAIK has this tool embedded, but I never used it.

    There are also graphical tools allowing you to resolve conflicts in software like SourceTree or similar, but it all depends on where the repository is and whether those graphical tools are available there.

    UPD: You also can revert this AM session changes by doing git am --abort which is written in the message. This will revert branch to the state before AM session started, effectively loosing the patch information.

提交回复
热议问题