Untrack already tracked file in Git repository

in Code Write a comment

Learn how to untrack a single file that has already been tracked in Git.

Suppose you have added all the files to the Git repository using the following command:

$ git add --all

Now you want to remove a single file from Git repository. You can do that by running the following command:

$ git rm --cached filename.txt

This command will remove the file from the local repository now you need to update the remote one:

$ git commit --all -m "removed filename.txt"

Hi, I'm Renat ๐Ÿ‘‹

โžœ  


Or if youโ€™re using git aliases you can just run:

$ gcam "removed filename.txt"

If you find this post useful, please let me know in the comments below. 
Cheers,
Renat Galyamov

Want to share this with your friends?
๐Ÿ‘‰renatello.com/git-untrack-single-file

PS: Make sure you check Git tutorials, e.g. create a branch from another branch in Git.

A collection of UI components for
Bootstrap 4/5 and Vue.js

Get now

Write a Comment

Comment