From: Andreas Schwab Date: Fri, 10 Jul 2020 14:04:34 GMT Subject: Re: "git rm" could be safer and have a better help msg Message-ID: <874kqf1n65.fsf@igel.home> In-Reply-To: On Jul 10 2020, Tom Browder wrote: > If the existing file has been modified, with 'rm' the '--cached' > option doesn't remove it from Git > unless one uses the '-f' option with it. It doesn't? Worksforme. $ echo >> zlib.c $ git status On branch master Your branch is up to date with 'origin/master'. Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: zlib.c no changes added to commit (use "git add" and/or "git commit -a") $ git rm --cached zlib.c rm 'zlib.c' $ git status On branch master Your branch is up to date with 'origin/master'. Changes to be committed: (use "git restore --staged ..." to unstage) deleted: zlib.c Untracked files: (use "git add ..." to include in what will be committed) zlib.c Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."