git assume-unchanged and git stash

1k views Asked by At

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?

2

There are 2 answers

0
Philip Oakley On BEST ANSWER

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

0
TaylorSanchez On

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?