To add files in Git, there are various commands available based on the scenario. Here are some of the commonly used Git commands for adding files:
- Add all files in the working directory to staging area:
git add .
- Add a specific file to staging area:
git add <filename>
- Add all files of a specific type to staging area:
git add *.txt
- Add all files in a specific directory to staging area:
git add <directory>/
After adding the files to the staging area, you can commit them using the following command:
git commit -m "commit message"
Note: Make sure to provide a meaningful commit message that describes the changes made in the commit.