简体   繁体   中英

How can I return to a half-merged file in PyCharm and continue merging?

I fixed half of my merge conflicts in PyCharm's diff tool, then decided I wanted to fix some of them in the plain text file, since it's full width. So I clicked "Apply", and now I have a file with <<<<<<HEAD in it that doesn't show up in the Resolve Conflicts window.

How can I finish the merge? I looked at https://stackoverflow.com/a/47712453/733092 to try to continue merging from the command line, but I couldn't figure out what to put in for pycharm merge <left file> <right file> [<base file>] <output file> .

My current plan is to copy the text of the file the way it is, abort the merge, restart, and paste it into the new merge window. But then I have to ignore all the changes I fixed already.

I also want to know this because people check in half-merged files and I would like to be able to continue those merges.

You could check the status in command-line, to see if the "Apply" in pyCharm completley terminated the merge or not.

If the git status is clean, then you can simply open you file with conflict merge marker, modify it (to keep only ours or theirs), removing the <<<< / >>>> markers, add and commit.

Regarding PyCharm, you could set it up as the default merge tool

[merge]
    tool = pycharm
    keepBackup = false
[mergetool "pycharm"]
    cmd = /usr/local/bin/pycharm merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

Then all you need to do is:

git mergetool -- yourFile_with_conflict_markers_in_it

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM