Skip to content

Instantly share code, notes, and snippets.

@FredLackeyOfficial
Forked from miraculixx/git-keep
Created June 21, 2017 18:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FredLackeyOfficial/bc7ad4a821c4d14b2bd3f83e3d6a7866 to your computer and use it in GitHub Desktop.
Save FredLackeyOfficial/bc7ad4a821c4d14b2bd3f83e3d6a7866 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment