The way you Git ignore watching/tracking a particular dir/file. you just run this:
git update-index --assume-unchanged <file>
Now how do you undo it so they are watched again? (Let's call it un-assume.)
The way you Git ignore watching/tracking a particular dir/file. you just run this:
git update-index --assume-unchanged <file>
Now how do you undo it so they are watched again? (Let's call it un-assume.)
If this is a command that you use often - you may want to consider having an alias for it as well. Add to your global
.gitconfig
:How to set an alias (if you don't know already):
Example:
After saving this to your
.gitconfig
, you can run a cleaner command.or
This git documentation was very helpful.
As per the comments, this is also a helpful alias to find out what files are currently being hidden:
I assume (heh) you meant
--assume-unchanged
, since I don't see any--assume-changed
option. The inverse of--assume-unchanged
is--no-assume-unchanged
.To synthesize the excellent original answers from @adardesign, @adswebwork and @AnkitVishwakarma, and comments from @Bdoserror, @Retsam, @seanf, and @torek, with additional documentation links and concise aliases...
Basic Commands
To reset a file that is assume-unchanged back to normal:
To list all files that are assume-unchanged:
To reset all assume-unchanged files back to normal:
Note: This command which has been listed elsewhere does not appear to reset all assume-unchanged files any longer (I believe it used to and previously listed it as a solution):
Shortcuts
To make these common tasks easy to execute in git, add/update the following alias section to
.gitconfig
for your user (e.g.~/.gitconfig
on a *nix or macOS system):If you are using Git Extensions, then follow below steps:
You are done.
git update-index function has several option you can find typing as below:
Here you will find various option - how to handle with the function update-index.
[if you don't know the file name]
[if you know the file name ]
will revert all the files those have been added in ignore list through.
To get undo/show dir's/files that are set to assume-unchanged run this:
git update-index --no-assume-unchanged <file>
To get a list of dir's/files that are
assume-unchanged
run this:git ls-files -v|grep '^h'