After fixing conflicts git still complains?

后端 未结 5 1503
半阙折子戏
半阙折子戏 2021-02-01 02:43

I usually rebase when I pull in changes from my teammates, and often time I have conflicts:

...
CONFLICT (content): Merge conflict in app/views/sear         


        
5条回答
  •  鱼传尺愫
    2021-02-01 03:36

    With Git 2.14 (Q3 2017), this kind of advice given in a rhetorical question that does not require an answer (like "did you forget to use 'git add'?") will be no more.

    See commit 6963893, commit 9932242, commit 6c48686 (11 May 2017) by Jean-Noel Avila (jnavila).
    (Merged by Junio C Hamano -- gitster -- in commit e638108, 29 May 2017)

    usability: don't ask questions if no reply is required

    When the spelling of a command contains errors, the git program tries to help the user by providing candidates which are close to the unexisting command. E.g Git prints the following:

        git: 'stahs' is not a git command. See 'git --help'.
        Did you mean this?
    
        stash
    

    and then exits.

    The problem with this hint is that it is not formally indicated as an hint and the user is in fact encouraged to reply to the question, whereas the Git command is already finished.

    The user was unlucky enough that it was the command he was looking for, and replied "yes" on the command line, effectively launching the yes program.

    The initial error is that the Git programs, when launched in command-line mode (without interaction) must not ask questions, because these questions would normally require a user input as a reply that they won't handle indeed. That's a source of confusion on UX level.

    To improve the general usability of the Git suite, the following rule was applied:

    if the sentence

    • appears in a non-interactive session
    • is printed last before exit
    • is a question addressing the user ("you")

    the sentence is turned into affirmative and proposes the option.

    In your case, "did you forget to use 'git add'?" is now replaced with:

    You should 'git add' each file with resolved conflicts to mark them as such.
    You might run git rm on a file to accept "deleted by them" for it.

    Much clearer.

提交回复
热议问题