0

Is there a way in git to maintain some files always unstaged?

Here's the context:

I've done some modifications to my source code that are just temporary (eg, I've modified my log level), in the meantime I've done some other "serious" mods. Clearly, I don't want to stage/commit the temp mods, but I want to keep them as long as I need and then discard them later (after several commits).

Can I, in some way, "flag" the temp mods such that they are in a sort of lock state where if I stage all files, the flagged ones remains in the unstaged area?

Thank you

AndreaCFH
  • 1
  • 1
  • 1
    Take a look at `git update-index --skip-worktree path/to/file`, doc [here](https://git-scm.com/docs/git-update-index#_skip_worktree_bit). There are duplicate questions for this I'm almost certain, if someone can search for a good one to point to. – Romain Valeri Sep 29 '22 at 10:26
  • The [Git FAQ](https://git-scm.com/docs/gitfaq#ignore-tracked-files) is very clear that there is no way to ignore tracked files and `git update-index` doesn't work for this purpose. Please don't suggest approaches that contradict the documentation. – bk2204 Oct 03 '22 at 21:59

0 Answers0