Skip to content

Instantly share code, notes, and snippets.

@timerring
Created November 21, 2024 12:03
Show Gist options
  • Select an option

  • Save timerring/1a1e7f5fd51372e709d9bb72c6c2bc99 to your computer and use it in GitHub Desktop.

Select an option

Save timerring/1a1e7f5fd51372e709d9bb72c6c2bc99 to your computer and use it in GitHub Desktop.

The essence of git is to track the files rather than the folders. Hence, if you just want to track the empty folder, which basically can not be supported in git and on github.

The solution is to add a .gitkeep file to the folder. Due to the property of hidden file, the file usually does not show up. And you can track it in the git, with the configuration in .gitignore:

targetFolder/*
!targetFolder/.gitkeep

You can just leave it as the blank file, or you can add some explanation in the file.

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