Git : Determine if branch is in a merge conflict state

后端 未结 3 796
离开以前
离开以前 2021-02-13 06:50

I am writing a bash script to do some automation. Part of the script involves navigating to a local repo, switching to the local master branch, then pulling the remote master to

3条回答
  •  情话喂你
    2021-02-13 07:06

    Based on the answer given by torek, here is a ready-to-use snippet:

    CONFLICTS=$(git ls-files -u | wc -l)
    if [ "$CONFLICTS" -gt 0 ] ; then
       echo "There is a merge conflict. Aborting"
       git merge --abort
       exit 1
    fi
    

提交回复
热议问题