Today I Learned

2 posts by hasithapathiraja

Stashing only some of your files

If you want to keep some files and stash the others, use git add to add the files you want to keep, and type

git stash --keep-index

Removing untracked files/directories in git

To remove untracked files/directories, use git-clean.

Running git-clean prints out what it would remove, without actually removing them.

-f flag removes the files and -d flag removes empty directories

So to remove untracked files and directories:

git clean -df

To also remove ignored files:

git clean -dfx