Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git update-index --assume-unchanged and git reset

Tags:

git

reset

Here is the scenario:

In my working directory, I have a number of files (let's call them A,B,C) that I've edited. I then ran git update-index --assume-unchanged on those files. Now git status returns blank. Good.

Now, if I do a git reset --hard, the contents of the files A,B, and C, revert back to the contents before I've edited them and "assume-unchanged" them.

Is there a way to stop git from actually reverting files A,B, and C, and simply ignore them?

Thanks,

Ken

like image 248
Ken Hirakawa Avatar asked May 23 '11 23:05

Ken Hirakawa


People also ask

What is assume unchanged in git?

When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index. If you want to change the working tree file, you need to unset the bit to tell Git.

What is refresh index in git?

git/index changed by windows. So it can only refresh the index and replace the . git/index file, which makes the next git status super fast and git status in windows very slow (because the windows system will refresh the index file again).


1 Answers

You can do:

git update-index --skip-worktree A 
like image 109
manojlds Avatar answered Oct 25 '22 18:10

manojlds