Is it possible to have git commit
also add new files and directories?
It seems a lot of needless typing in the long run to have to type git add .
then git commit
(That, and I have a tendency to often forget to call git add .
resulting in versions with missing directories and such)
Committing in git can be a multiple step process or one step depending on the situation. This situation is where you have multiple file updated and wants to commit: You have to add all the modified files before you commit anything. with this you have to add the message for this commit.
Once you're ready to craft your commits, you'll use git add <FILENAME> to specify the files that you'd like to "stage" for commit. Without adding any files, the command git commit won't work.
git add one file that's at the deepest layer of your file structure (the latest level of a Folder you want to add). Then, git add --all :/ . It will add all the Folders , Subfolders and files to the existing repo.
To add and commit files to a Git repository Create your new files or edit existing files in your local project directory. Enter git add --all at the command line prompt in your local project directory to add the files or changes to the repository. Enter git status to see the changes to be committed.
As long as I am informed right there is no such command (It could be dangerous when you have debug-files containing passwords), but if you want to simulate you could add this alias to your git config:
git config --global alias.commitx "!git add . && git commit"
Using git commitx
will now run git add .
followed by git commit
, so you can do
git commitx -m "testing commitx on new unstaged files"
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