Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ignore existing file in Git?

I need to work on file.txt locally and in Git, with different content. I want Git not to tell me that there have been changes to that file.

Is this possible?

like image 288
kassie Avatar asked Dec 11 '13 16:12

kassie


People also ask

How do I ignore a git file without Gitignore?

To ignore untracked files, you have a file in your git folder called . git/info/exclude . This file is your own gitignore inside your local git folder, which means is not going to be committed or shared with anyone else. You can basically edit this file and stop tracking any (untracked) file.


1 Answers

Actually, you want --skip-worktree, not --assume-unchanged. Here's a good explanation why.

So git update-index --skip-worktree file.txt

TLDR; --assume-unchanged is for performance, for files that won't change (like SDKs); --skip-worktree is for files that exist on remote but that you want to make local (untracked) changes to.

like image 53
Tom Auger Avatar answered Sep 19 '22 10:09

Tom Auger