11

Is there a way to find the files I've set to 'Assume Unchanged'?

I've modified several files and wanted to pull, so I've set them to 'Assume Unchanged'. Now I'm finished and want to commit, but they don't appear in the Git Staging window.

I use Eclipse 4.4.2.

s.d
  • 4,017
  • 5
  • 35
  • 65
KGBR
  • 435
  • 1
  • 8
  • 17

4 Answers4

21

Well, it's correct that they wouldn't appear in the staging view. From the git docs:

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 "re-track" changes, do git update-index --no-assume-unchanged <file>.

In Eclipse, this works as follows: Right-click on file > Team > Advanced > No Assume Unchanged. After having done this, the file will show up in the Unstaged Changed section of the Git Staging View.

s.d
  • 4,017
  • 5
  • 35
  • 65
  • 1
    Thank you, by doing this they do appear in git staging. But i dont want to miss any of the files, so my question was whether i can find a list of files set to 'assume unchanged' somewhere. Sorry if the question wasnt clear. – KGBR Oct 14 '15 at 08:36
  • but "Right-click on file > Team > Advanced > No Assume Unchanged" not works. – softwarevamp Nov 13 '18 at 09:10
  • I found an easier way. Open the file in editor and in Quick Access type "No Assume Unchanged" and Press "Enter". Now your file will appear in Git Stating view – Avinash Jan 09 '20 at 09:59
4

Files with assume-unchanged flag set are decorated with a little blue checkmark, see Preferences > Team > Label decorations

See https://bugs.eclipse.org/bugs/show_bug.cgi?id=581862 for hints how listing files having assumeValid set could be implemented. In case someone wants to contribute an implementation.

Matthias Sohn
  • 351
  • 1
  • 6
  • Useful, but what if I have many files? Looking at each would take hours. Is there a "show list of assume-unchanged files" ? – David Balažic Apr 26 '23 at 10:22
1

Besides getting these files back under version control, there is another point that might help you. When you lose overview of the file you marked as --assume-unchanged, you would like to get a list of these files.

You can get this list via command line and executing following line as mentioned in [Can I get a list of files marked --assume-unchanged?]:

git ls-files -v | grep '^[[:lower:]]' 

So you get an output like that:

h path/to/ignored.file
h another/ignored.file

But be aware that you need the mentioned commands (git and grep) on your path. Easiest way to achieve that in Windows to install these is to use chocolatey.org: Get a Powershell as administrator and execute following commands:

Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))

This installs chocolatey. Then you install git if you still need it:

choco install git

and then you install grep:

choco install grep

That's it.

armin.miedl
  • 1,070
  • 1
  • 11
  • 16
1

Because eclipse makes it so easy to accidentally click the "Assume Unchanged" option when trying to click "Replace with HEAD Revision" in the Git Staging view, I needed to use a combination of the answers above.

One, to view all the files I ran the following (thanks @armin.midel ) :
git ls-files -v | grep '^[[:lower:]]'

Remove the file using the following (thanks @s.d.):
git update-index --no-assume-unchanged <file>