4

I keep some of my local configuration in assume-unchanged files. I have several branches created over time, and assumed-unchanged files have evolved in between (adding more local config). If I try to checkout an older branch, I get:

error: Your local changes to the following files would be overwritten by checkout:
    <some assume-unchanged files>
Please, commit your changes or stash them before you can switch branches.

I don't want to commit them and cannot stash them (even with the --include-untracked option):

$ git stash
No local changes to save

Is there a solution for this, or a better workflow for local changes to keep uncommitted?

Chris Maes
  • 35,025
  • 12
  • 111
  • 136
edhel
  • 183
  • 10
  • Assume-unchanged is often misunderstood as an ignore flag. It's not. It's a promise that you won't change the file and that git doesn't have to waste cycles on slow file systems checking the status. certain commands will still check all the files and track/include changes as appropriate, and simply ignore that flag. It has caught out a number of users. – Philip Oakley Dec 11 '14 at 15:34

2 Answers2

1

At the moment you will need to use a proper .gitignore file or the excludes mechanism. Assume-unchanged means something different.

Philip Oakley
  • 13,333
  • 9
  • 48
  • 71
1

I was dealing with a similar scenario and found using .git/info/exclude worked better for me than excluding .gitignore

.git/info/exclude is available for individual clones only, hence what one person ignores in his clone is not available in some other person's clone. For example, if someone uses Eclipse for development it may make sense for that developer to add .build folder to .git/info/exclude because other devs may not be using Eclipse.

When would you use .git/info/exclude instead of .gitignore to exclude files?

TaylorSanchez
  • 463
  • 1
  • 5
  • 8