Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

git commit auto add new folders or files?

Tags:

git

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)

like image 723
ina Avatar asked Jan 21 '12 20:01

ina


People also ask

Does git commit add all files?

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.

Can I commit without adding files?

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.

Does git add include folders?

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.

How Add folder to git commit?

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.


1 Answers

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"
like image 114
TimWolla Avatar answered Oct 31 '22 02:10

TimWolla