Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How "git stash -A" exclude .gitignore content?

Tags:

git

gitignore

I add .gitignore.Like this: prebuilts out

I use "git stash -A" to stash my modifies,but prebuilts folder,out folder also stash. I don't want stash my ignore folder,what can I do ?

like image 935
wang Avatar asked Oct 28 '25 05:10

wang


1 Answers

You might not want to use git stash --all, since the doc mentions:

If the --all option is used instead then the ignored files are stashed and cleaned in addition to the untracked files.

And if some ignored files are still stashed, make sure they were not already tracked: do a git status before the stash: if the out folder has some files currently modified, that means they were added to the index and tracked already (git add -f would be able to add a file even if it is declared ignored)

Check also which ignore rule actually does (or does not) apply to any file with:

git check-ignore -v -- afile
like image 103
VonC Avatar answered Oct 29 '25 21:10

VonC