Skip to content

Instantly share code, notes, and snippets.

@miraculixx
Created October 4, 2014 03:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save miraculixx/5888638d71c7dcc8167b to your computer and use it in GitHub Desktop.
Save miraculixx/5888638d71c7dcc8167b to your computer and use it in GitHub Desktop.
create .keep files for empty directories currently ignored by git
#!/bin/bash
# create .keep files for empty directories currently ignored by git
# run git clean -nd to see which directories are empty and therefore ignored by git currently
# run git keep to add these directories by adding a .keep file
# see this discussion http://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory-to-a-git-repository/21422128#21422128
git clean -nd | awk '{ print $3 }' | xargs -L1 -I{} touch {}.keep
@domJalb
Copy link

domJalb commented Aug 19, 2015

This is exactly what I needed, rock on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment