From bb5c734d7445097e94c4a602f5ce066a836dbead Mon Sep 17 00:00:00 2001 From: Jasper Ras Date: Tue, 6 May 2025 17:51:09 +0200 Subject: vault backup: 2025-05-06 17:51:09 --- Ignoring a file that is already committed.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Ignoring a file that is already committed.md (limited to 'Ignoring a file that is already committed.md') diff --git a/Ignoring a file that is already committed.md b/Ignoring a file that is already committed.md new file mode 100644 index 0000000..33fdfb2 --- /dev/null +++ b/Ignoring a file that is already committed.md @@ -0,0 +1,14 @@ +--- +tags: + - git +--- +This is where `git rm` comes in: If we add `--cached` it removes a file from the git repository (but it will stay in the working directory). + +```bash +$ echo debug.log >> .gitignore +   +$ git rm --cached debug.log +rm 'debug.log' +   +$ git commit -m "Start ignoring debug.log" +``` -- cgit v1.2.3