Jake
Jake

Reputation: 11430

Git Stash while keeping ignored files

As a Git beginner, I am using

I am working on the master branch with many breaking changes that I do not want to commit yet, but need to immediately add features to the last release. I read that Stash Save is the answer.

I have some files that I use in all versions such as a local configuration config.php, some test files etc. that should not be commited to the remote repository, so they are untracked or ignored.

Tortise Git gives the include untracked and --all options, and both of them remove ignored files from the reverted working directory.

Is it possible using Tortise Git or otherwise to keep ignored files in the reverted workign directory?

Upvotes: 3

Views: 3270

Answers (1)

Klas Mellbourn
Klas Mellbourn

Reputation: 44347

A normal git stash without flags keeps the ignored files intact. They are not removed.

In TortoiseGit this means leaving include untracked and --all unchecked:

stash with no options

If you wish to stash (and remove) both your modified and untracked files, but not your ignored files, then use the include untracked option (git stash --include-untracked): enter image description here

Upvotes: 1

Related Questions