HG(RESOLVE)

πŸ’– hg resolve πŸ’–

okay bestie, welcome to the hg resolve page from the HG(RESOLVE) manual β€” yes that's the whole header, it's giving mysterious, we move. this one's all about redoing merges and setting or viewing the merge status of files, and honestly? it's the glow-up your messy merge has been waiting for. πŸ¦‹


✨ NAME ✨

hg resolve β€” redo merges or set/view the merge status of files. periodt. πŸ’…


🌸 SYNOPSIS 🌸

hg resolve [OPTION]... [FILE]...

πŸŽ€ DESCRIPTION πŸŽ€

so, merges with unresolved conflicts? super often they're the leftovers of a non-interactive merge β€” like when you're using the internal:merge configuration setting, or some command-line merge tool like diff3. and that's exactly where hg resolve comes in, bestie: it's the command you use to manage all the files caught up in a merge, after hg merge has run and before hg commit runs. (translation: your working directory has to have two parents, no exceptions.) if you wanna know how to configure your merge tools, go read hg help merge-tools. πŸ’œ

here's every single way you can use hg resolve, no gatekeeping:

  • hg resolve [--re-merge] [--tool TOOL] FILE...: this one tries to re-merge the files you name, and it just straight-up discards any previous merge attempts like they never happened. (iconic behavior honestly.) but heads up β€” re-merging does not happen for files that are already marked as resolved. wanna select all the unresolved files instead? that's --all/-a, easy. and --tool lets you pick the merge tool used for those files β€” it overrides the HGMERGE environment variable and your configuration files, so it wins, no cap. also your previous file contents get saved with a .orig suffix, so nothing's truly gone. 🫢
  • hg resolve -m [FILE]: marks a file as having been resolved β€” perfect for when you already fixed stuff up by hand. and if you don't name any files, the default is to mark all unresolved files. ✨
  • hg resolve -u [FILE]...: marks a file as unresolved. and again, no files named means the default kicks in β€” this time it marks all resolved files. πŸ”₯
  • hg resolve -l: lists the files that had conflicts or still have them. in the printed list, U = unresolved and R = resolved. you can filter that list with set:unresolved() or set:resolved() β€” details live in hg help filesets. πŸŽ€
Note 🚨 Mercurial will not let you commit files with unresolved merge conflicts. like, at all. you must run hg resolve -m ... before you can commit after a conflicting merge. that's not a suggestion, that's the law. 😭

🌈 Template 🌈

besides the common template keywords and functions, these keywords are supported too β€” also peep hg help templates for more:

  • mergestatus β€” String. the character denoting merge conflicts, U or R. ⭐
  • path β€” String. the repository-absolute path of the file.

Returns 0 on success, 1 if any files fail a resolve attempt. (yes, that's the exit status, and yes, you should care about it.) πŸ’…


πŸ’… OPTIONS πŸ’…

  • -a, --all β€” select all unresolved files
  • -l, --list β€” list state of files needing merge
  • -m, --mark β€” mark files as resolved
  • -u, --unmark β€” mark files as unresolved
  • -n, --no-status β€” hide status prefix
  • --re-merge β€” re-merge files
  • -t, --tool <TOOL> β€” specify merge tool
  • -I, --include <PATTERN[+]> β€” include names matching the given patterns
  • -X, --exclude <PATTERN[+]> β€” exclude names matching the given patterns
  • -T, --template <TEMPLATE> β€” display with template

[+] marked option can be specified multiple times 🧚


and that's the whole page, bestie β€” that footer line down there just says HG(RESOLVE) again, which is the manual source and version, and there's no date attached, so consider this your official cute sign-off: go resolve those conflicts, you absolute main character. πŸ’–βœ¨πŸŽ€πŸ¦‹