HG(COMMIT)

πŸ’– HG(COMMIT) πŸ’–

okay bestie, welcome to hg commit β€” literally one of the most iconic Mercurial pages in the whole manual, no cap. it's giving "save your work, queen" energy. ✨


🌸 NAME 🌸

hg commit β€” commit the specified files or all outstanding changes 🫢


✨ SYNOPSIS ✨

hg commit [OPTION]... [FILE]...

πŸ¦‹ DESCRIPTION πŸ¦‹

So what you're doing here is committing changes to the given files into the repository. And here's the tea: unlike a centralized SCM, this operation is a local operation. like, it happens on your machine, by yourself, main character energy. if you want a way to actively distribute your changes, go see hg push. πŸ‘‘

If you just... don't give it a list of files? Then all the changes reported by hg status get committed. all of them. the whole vibe. πŸ’…

If you are committing the result of a merge, do not provide any filenames or -I/-X filters. like, just don't, okay? that's the rule. πŸ™ˆ

If no commit message is specified, Mercurial starts your configured editor where you can enter a message. and if your commit fails (crying), you will find a backup of your message in .hg/last-message.txt. so your words are safe, bestie, breathe. 😭

The --close-branch flag can be used to mark the current branch head closed. When all heads of a branch are closed, the branch will be considered closed and no longer listed. periodt. πŸŽ€

The --amend flag can be used to amend the parent of the working directory with a new commit that contains the changes in the parent in addition to those currently reported by hg status, if there are any. The old commit is stored in a backup bundle in .hg/strip-backup (see hg help bundle and hg help unbundle on how to restore it). iconic, honestly. ⭐

Message, user and date are taken from the amended commit unless specified. When a message isn't specified on the command line, the editor will open with the message of the amended commit. convenient much? 🧚

big caveat time: it is not possible to amend public changesets (see hg help phases) or changesets that have children. like, it will not work. don't try it. πŸ’€

See hg help dates for a list of formats valid for -d/--date. πŸ—“οΈ

Returns 0 on success, 1 if nothing changed. 🌈

Examples:

  • commit all files ending in .py:
hg commit --include "set:**.py"
  • commit all non-binary files:
hg commit --exclude "set:binary()"
  • amend the current commit and set the date to now:
hg commit --amend --date now

πŸ’… OPTIONS πŸ’…

  • -A, --addremove β€” mark new/missing files as added/removed before committing πŸ“
  • --close-branch β€” mark a branch head as closed πŸŽ€
  • --amend β€” amend the parent of the working directory ✨
  • -s, --secret β€” use the secret phase for committing 🀫
  • --draft β€” use the draft phase for committing πŸ“
  • -e, --edit β€” invoke editor on commit messages ✍️
  • --force-close-branch β€” forcibly close branch from a non-head changeset (ADVANCED) πŸ”₯
  • -i, --interactive β€” use interactive mode πŸ•ΉοΈ
  • -I,--include <PATTERN[+]> β€” include names matching the given patterns πŸ’–
  • -X,--exclude <PATTERN[+]> β€” exclude names matching the given patterns πŸ™…
  • -m,--message <TEXT> β€” use text as commit message πŸ’¬
  • -l,--logfile <FILE> β€” read commit message from file πŸ“„
  • -d,--date <DATE> β€” record the specified date as commit date πŸ“…
  • -u,--user <USER> β€” record the specified user as committer 🫢
  • -S, --subrepos β€” recurse into subrepositories πŸͺ†
the [+] marked option can be specified multiple times β€” go off, stack them, whatever, live your truth. πŸ’œ

πŸ‘‘ ALIASES πŸ‘‘

ci


and that's the whole page, bestie!! πŸŽ‰ this was HG(COMMIT) from the HG(COMMIT) manual β€” same title top and bottom, cute little sandwich β€” so consider this your sign-off: HG(COMMIT), the commit page, that's the one πŸ’–βœ¨ go commit something and slay. πŸ¦‹πŸŒΈ