How do i configure git to keep empty folders in my repository?
-
git man page: http://bit.ly/2nvGNWB
Git does not track empty folder so many developers, create a .gitkeep file inside empty folders to keep track of the folders.
$ mkdir trainers tshirt watch water
However git does not see the directory.
$ ls trainers tshirt watch README.md water $ git status On branch master nothing to commit, working directory clean
If you create an empty file in each directory called .gitkeep it will start tracking the directory.
$ touch trainers/.gitkeep tshirt/.gitkeep watch/.gitkeep water/.gitkeep $ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) trainers/ tshirt/ watch/ water/ nothing added to commit but untracked files present (use "git add" to track)
Now add them to the repository
$ git status On branch master Untracked files: (use "git add <file>..." to include in what will be committed) trainers/ tshirt/ watch/ water/ nothing added to commit but untracked files present (use "git add" to track)
Commit them
$ git commit -m "Created some directories" [master 4be0f9b] Created some directories 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 trainers/.gitkeep create mode 100644 tshirt/.gitkeep create mode 100644 watch/.gitkeep create mode 100644 water/.gitkeep
© Lightnetics 2024