How to commit Specific files in Git
In this tutorial, we are going to learn about how to commit specific files in git instead of committing all files.
Committing specific files
-
Change your current working directory to the git repository.
-
Now, add the files you need to commit by running the
git add
command followed by your file names.
git add my-file1.js my-file2.js
- Run the
git commit
command to commit your specified files in step 2.
git commit -m 'added my-file1.js & my-file2.js'