If you want to add all files in a folder recursively to a Git repository, here is how you can do it
1 Basic Command to Add All Files
To add all files inside a folder and its subfolders, use
git add foldername
- This will recursively add all files and subfolders inside the specified folder
- If you want to add everything in the current directory, use
git add .
This will include all new, modified, and deleted files
2 Checking What Will Be Added
Before committing, you can check what is being staged by running
git status
This will show a list of tracked and untracked files
3 Committing the Changes
Once all files are added, commit them using
git commit -m "Added all files in the folder"
Replace the message with something meaningful
4 Ignoring Unwanted Files
If you do not want to add certain files, create a .gitignore file and list the files or folders you want to ignore
Example
node_modules
*.log
*.tmp
Then run
git add .
git commit -m "Added all required files"
5 Final Thoughts
- Use git add foldername to add a specific folder
- Use git add . to add everything in the current directory
- Always check git status before committing to avoid adding unwanted files
- Use .gitignore to exclude unnecessary files