mddanishyusuf / dailyhack

🐱‍💻 Tiny Tiny Hacks we use in our daily life.
https://dailyhack.now.sh/
149 stars 15 forks source link

Ignoring a previously committed file quickly #45

Open sashadev-sky opened 5 years ago

sashadev-sky commented 5 years ago

Files already tracked by Git are not effected by the .gitignore file.

If you want to ignore a file that you've committed in the past,

$ echo debug.log >> .gitignore
$ git rm --cached debug.log
rm 'debug.log'
$ git commit -m "Start ignoring debug.log"
mddanishyusuf commented 5 years ago

Thanks, @sashadev-sky this is what we called cool hack.

fajarsiddiqfs commented 5 years ago

Nice, thanks for sharing this!