Search code examples
git

Git update-index assume unchanged - Does it push to remote


I've read about how people are using git update-index with --assume-unchanged to temporarily ignore some files that were "modified" but we don't want to ignore those modification.

For example, in my project I have some sort of launcher file, that comes with the standard launcher. but when the project is built locally, the launcher file's property might change but I want to "ignore" this. The usage of update-index --assume-unchanged is very tempting.

My question is, if I forget to retrack it back ie --no-assume-unchange it, and push it to remote, what are the implications?

Thanks


Solution

  • My question is, if I forget to retrack it back ie --no-assume-unchange it, and push it to remote, what are the implications?

    None (for the upstream repo): updating the index is a purely local operation, which isn't pushed at all.


    Would you please know of any way to push those changes to the remote?

    Since Git ignores local modifications for files marked with --assume-unchanged, there is no direct way to push those changes.

    If you want to have your local modifications included in a commit, you must first revert the flag using git update-index --no-assume-unchanged launcher.file.

    By unsetting the assume-unchanged flag, you make Git aware of the modifications.
    After that, a normal add/commit/push sequence will send your changes to the remote repository.