HG(REMOVE)

πŸ’… NAME πŸ’…

okay so bestie, hg remove β€” it removes the files you point at, on the next commit. that's the whole vibe. it's giving "schedule the cleanup, do the cleanup later." 🧹✨


✨ SYNOPSIS ✨

hg remove [OPTION]... FILE...

πŸ¦‹ DESCRIPTION πŸ¦‹

So what this actually does is schedule the files you name for removal from the current branch. Nothing gets committed yet β€” you're just putting it on the calendar. πŸ“…

It queues those files to be gone at the next commit. Wanna undo a remove before that commit happens? Go see hg revert, she'll fix you right up. Wanna undo files you added? That's hg forget's job, not this one. 🫢

Now here's the tea on the flags, because they change everything:

  • -A/--after is for removing only files that are already deleted on disk. like, "yeah girl, I know she's gone, just record it."
  • -f/--force forces the deletion. no thoughts, just vibes.
  • -Af (yes, together) removes files from the next revision without deleting them off your working directory. they leave the branch but stay on your disk. iconic behavior honestly. πŸ’…

🌈 the big table of what happens 🌈

The following table details the behavior of remove for different file states (columns) and option combinations (rows). The file states are Added [A], Clean [C], Modified [M] and Missing [!] (as reported by hg status). The actions are Warn, Remove (from branch) and Delete (from disk):

                β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”¬β”€β”€β”€β”
                β”‚ opt/state β”‚ A β”‚ C  β”‚ M  β”‚ ! β”‚
                β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€
                β”‚ none      β”‚ W β”‚ RD β”‚ W  β”‚ R β”‚
                β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€
                β”‚ -f        β”‚ R β”‚ RD β”‚ RD β”‚ R β”‚
                β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€
                β”‚ -A        β”‚ W β”‚ W  β”‚ W  β”‚ R β”‚
                β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€
                β”‚ -Af       β”‚ R β”‚ R  β”‚ R  β”‚ R β”‚
                β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”˜
⚠️ Note β€” hg remove never deletes files in Added [A] state from the working directory. Not even if --force is specified. Not even then. She said no. πŸ™…β™€οΈ

Returns 0 on success, 1 if any warnings were encountered. so if you see a 1, something was side-eyeing you. 😭


πŸŽ€ OPTIONS πŸŽ€

  • -A, --after β€” record delete for missing files (only the ones already ghosted πŸ‘»)
  • -f, --force β€” forget added files, delete modified files (brute force era πŸ’ͺ)
  • -S, --subrepos β€” recurse into subrepositories (we goin deep πŸ•³οΈ)
  • -I, --include <PATTERN[+]> β€” include names matching the given patterns
  • -X, --exclude <PATTERN[+]> β€” exclude names matching the given patterns
  • -n, --dry-run β€” do not perform actions, just print output (window shopping only, bestie πŸ›οΈ)
[+] marked option can be specified multiple times β€” stack 'em, she can take it πŸ’–

🌸 ALIASES 🌸

rm β€” yeah you can just type that, it's the same thing, iykyk 😌


and that's the whole page, bestie!! this was hg remove from the HG(REMOVE) manual β€” same name up top, same name at the bottom, we love a full-circle moment. stay scheduled, stay slayed. πŸ¦‹πŸ’œβœ¨