How to add an empty directory to a Git repository

0 votes

Hi Guys,

I am new to Git. I want to add an empty directory to the Git repository. How can I do that?

Oct 5, 2020 in Git & GitHub by akhtar
• 38,170 points
60 views

1 answer to this question.

0 votes

Hi@akhtar,

A popular solution is to simply add a file named ".keep" in the corresponding folder. You can now stage and commit this file and, as a consequence, also add the folder to version control.

Note that .keep is not a "magical" name but rather a popular convention. Also, the file doesn't serve any other purpose beyond making its containing folder visible to Git.

answered Oct 5, 2020 by MD
• 95,060 points

Related Questions In Git & GitHub

0 votes
1 answer

How to add a remote git repository in Jenkins

Follow these steps: Step 1 Go to Manage ...READ MORE

answered May 23, 2019 in Git & GitHub by Alok
1,415 views
0 votes
2 answers

How to view the nested workflow of a local git repository?

The closest way to view branches in ...READ MORE

answered Aug 2, 2019 in Git & GitHub by Sirajul
• 58,990 points
338 views
0 votes
1 answer

Is there a way to remove a directory from git repository?

This is simple, just follow the commands ...READ MORE

answered Jul 13, 2018 in Git & GitHub by Sophie may
• 10,530 points
155 views
0 votes
1 answer

How to revert a Git repository to a previous commit?

Hi@akhtar, This depends a lot on what you ...READ MORE

answered Dec 21, 2020 in Git & GitHub by MD
• 95,060 points
37 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 26, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
946 views
+2 votes
1 answer
0 votes
1 answer

How to pull from a Git repository through an HTTP proxy?

Hi@akhtar, You can set the HTTP proxy that Git ...READ MORE

answered Nov 21, 2020 in Git & GitHub by MD
• 95,060 points
64 views
0 votes
1 answer

How to change the URL for a remote Git repository?

Hi@akhtar, You can use the git remote command ...READ MORE

answered Nov 21, 2020 in Git & GitHub by MD
• 95,060 points
57 views