I had this project with a lot .c files in source directory,then I make the project, there is .o files inside of the project, I also want to push these files to repository,so instead of add each .o which is possible but...,how to add .o files easily?
You can add all the files using the git add command like below for all the files you want to add, which will add all your files to the staging area, which means the files are ready to be committed. Now commit your files, the editions or addition made in the files will now be saved.
The easiest way to add all files to your Git repository is to use the “git add” command followed by the “-A” option for “all”. In this case, the new (or untracked), deleted and modified files will be added to your Git staging area. We also say that they will be staged.
Yes! This is going to work!
You can add to git by explicitly listing each file with spaces as delimiters.
$ git add file-name-1.php file-name-2.js file-name-3.html …
The accepted answer is perfect for the OP’s specific case. But I got here—via Google—needing to add multiple files with different extensions. Posting here in case you miss this similar answer to a similar question.
Git interactive staging can also work wonders. To enter interactive staging (aka: adding, removing files):
$ git add -i
Putting aside the fact, that this is just a terrible idea, you can add them as any other file:
git add *.o git commit -m "Committing compiled files, which is bad"
Of course instead of git add *.o
you can use git add */*.o
or even find -name *.o | while read x; do git add $x; done
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With