HG(ADDREMOVE)
π hg addremove β the HG(ADDREMOVE) manual page, bestie edition π
okay so. you're in the hg manual, specifically the ADDREMOVE page, and honestly? this one is a little workhorse and it deserves main character energy. let's go π«Ά
β¨ NAME β¨
hg addremove β add all new files, delete all missing files
like... it does both things. at once. iconic behaviour honestly π
πΈ SYNOPSIS πΈ
hg addremove [OPTION]... [FILE]...
π¦ DESCRIPTION π¦
Add all new files and remove all missing files from the repository. that's it, that's the whole vibe β it's the "clean up my repo for me" button β¨
Unless names are given, new files are ignored if they match any of the patterns in .hgignore. and just like with add, these changes take effect at the next commit β so nothing is locked in until you actually commit, no cap.
Use the -s/--similarity option to detect renamed files. This option takes a percentage between 0 (disabled) and 100 (files must be identical) as its parameter. With a parameter greater than 0, this compares every removed file with every added file and records those similar enough as renames. π
Detecting renamed files this way can be expensive. like, it's doing a lot of comparing, bestie. be warned π«
After using this option, hg status -C can be used to check which files were identified as moved or renamed. If not specified, -s/--similarity defaults to 100 and only renames of identical files are detected.
π Examples π
1. A number of files (bar.c and foo.c) are new, while foobar.c has been removed (without using hg remove) from the repository:
$ ls
bar.c foo.c
$ hg status
! foobar.c
? bar.c
? foo.c
$ hg addremove
adding bar.c
adding foo.c
removing foobar.c
$ hg status
A bar.c
A foo.c
R foobar.c
2. A file foobar.c was moved to foo.c without using hg rename. Afterwards, it was edited slightly:
$ ls
foo.c
$ hg status
! foobar.c
? foo.c
$ hg addremove --similarity 90
removing foobar.c
adding foo.c
recording removal of foobar.c as rename to foo.c (94% similar)
$ hg status -C
A foo.c
foobar.c
R foobar.c
Returns 0 if all files are successfully added. π₯³
β¨ OPTIONS β¨
-s,--similarity <SIMILARITY>β guess renamed files by similarity (0<=s<=100). yes it's a guessing game, but a math one π§-S,--subreposβ recurse into subrepositories. it goes deeper. it's giving inception π-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 but for commits π
[+]marked option can be specified multiple times. so-Iand-X? stack 'em, babe π
okay that's the whole page, you're officially an hg addremove girlie now. this was the HG(ADDREMOVE) manual page β same title at the top, same title at the bottom, that's just how these things are formatted, iykyk π go add and remove some files, you got this fr fr π
π¦ where this page comes from
- arch rolling: mercurial 7.2.4-1 Β· GPL
- fedora 43: mercurial 7.1.1-1.fc43 Β· GPL-2.0-or-later
- fedora 43: mercurial 7.1.1-2.fc43 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2-1.fc44 Β· GPL-2.0-or-later
- fedora 44: mercurial 7.2.4-1.fc44 Β· GPL-2.0-or-later
- nixos 26.05: mercurial 7.1.2
- nixos 26.05: mercurial-full 7.1.2
- nixpkgs unstable: mercurial 7.2.2
- nixpkgs unstable: mercurial-full 7.2.2
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: mercurial 7.0.1-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms