Git merge left HEAD marks in my files

前端 未结 5 730
旧时难觅i
旧时难觅i 2020-11-22 15:26

I tried to merge a file in the command line using Git, when an error message appeared telling me the merge was aborted.

I thought that was the end of it, but then I

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-22 15:49

    All of the answers are right but if you want to Autoremove all conflict marks & want to autochange the files to keep HEAD , then You can create your own bash script like :-

    Example Script:

    # vim /usr/sbin/solve.git

    (Append Following)

    #!/bin/bash
    for f in $(grep -Rl '^>>>>>>> ' --include="*.php" --include="*.css" --include="*.js" --include="*.html" --include="*.svg" --include="*.txt" .)
    do
    sed -i -e '/^=======/,/^>>>>>>> /d' -e '/^<<<<<<< /d' $f
    sed -i -e '/^>>>>>>> /d' $f
    echo "$f Fixed"
    done
    git add . ; git commit -am "[+] Resolved on `date` from `hostname` by `whoami`" --no-verify
    

    # chmod 755 /usr/sbin/solve.git

    & just run it in your GIT repo/path to resolve:

    $ cd
    $ solve.git

    Notice:- Above mentioned file extensions are php,css,js,html,svg & txt.

提交回复
热议问题