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.

6
  • You should probably stash them. Oct 14, 2015 at 8:13
  • @AleksandrM Setting "Assume Unchanged" is fine for pulling. The OA just needs to "unset" the flag again for the files to appear as unstaged changes.
    – s.d
    Oct 14, 2015 at 8:15
  • @s.d: It has own caveats. Stash is probably more straightforward. Oct 14, 2015 at 8:20
  • @AleksandrM: True. However, I'm not in the position to mess with the OA's decisions, if s/he's chosen to go down the "assume unchanged" route, I assume s/he has his/her reasons :).
    – s.d
    Oct 14, 2015 at 8:27
  • 1
    @Aleksandr M: Yes that is the sole reason. :)
    – KGBR
    Oct 14, 2015 at 8:51

4 Answers 4

22

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.

3
  • 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, 2015 at 8:36
  • but "Right-click on file > Team > Advanced > No Assume Unchanged" not works. Nov 13, 2018 at 9: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 9, 2020 at 9: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.

1
  • Useful, but what if I have many files? Looking at each would take hours. Is there a "show list of assume-unchanged files" ? Apr 26 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.

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>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.