gitgitignoregit-assume-unchangedgit-skip-worktree

Does git update-index --skip-worktree affect the upstream repo?


I've been working with git for a while myself, and am now setting up a repo for our team. We develop a eCommerce platform.

There are a few directories and files to be ignored, such as the upload directory and environment specific config files.

While the config files are on .gitignore, I'd like to ignore the uploads directory with either --skip-worktree or --assume-unchanged.

My question - which I couldn't find an explicit answer on - is if the --assume-unchanged or --skip-worktree bit will be pushed to the upstream repo?

If not, what would be the optimal way to ensure that git doesn't manipulate the contents of the uploads directory, across ALL instances of the repository?


Solution

  • No, both --assume-unchaged and --skip-worktree is only used to mark the files in your local repository which you want to avoid committing or skip when scanning for changes.

    If you want to ignore files globally in all repositories, the best way is to put the mask into .gitignore:

    *.class         # will ignore all class files anywhere
    /tmp/           # will ignore tmp directory but only in top directory
    /config/prod/*  # will ignore all configuration files in /config/prod path