Answer the question
In order to leave comments, you need to log in
Git - how to add subfolders to a repository?
The project has a results folder and results/graphs nested in it.
Both the first and the second will contain files that should be ignored by git.
Both of these folders need to be added to the repository so that when cloned, these folders are also created immediately. There is a way to add a .gitignore file with content:
# Ignore everything in this directory
*
# Except this file
!.gitignore
Answer the question
In order to leave comments, you need to log in
Put this file in both subdirectories and add it to tracking.
In a nested directory, you need to add .gitignore via an add force.git add -f path/to/results/graphs/.gitignore
I did this, added two .gitignore files to both folders, with the following content:
results/.gitignore
# Ignore everything in this directory
/*
# Except this file
!.gitignore
!graphs
# Ignore everything in this directory
*
# Except this file
!.gitignore
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question