Tell me what keys to hold, but it's hard to add all the files I need to git with handles.

  • все нужные мне файлы в гит добавлять - and why not add files with the -A key? Like this: git add -A , or add to the catalog, indicating the path - AK
  • The fact is that I don’t need to add 1/3 of files, and everything will be added as I understand it - Dunai
  • @Dunai, and where do you get the list of files from which you want to copy the files you need? - aleksandr barakin
  • @alexanderbarakin Do you think there is a file with a list of what you need to add and automate the process? In principle, if there was such a file, it would be possible to quickly add them - but it seems to me that this is the author's idea in my head about how the commit should be divided into several smaller ones. - AK
  • @AK, perhaps the author of the question copies from the output of git status . so I clarify. - aleksandr barakin

1 answer 1

Add files to individual directories:

It was:

 $ git status # On branch master # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: calc/index.php # modified: include/configs/keys.php # no changes added to commit (use "git add" and/or "git commit -a") 

Executed the command:

 $ git add calc/ 

It became:

 $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: calc/index.php # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: include/configs/keys.php # $ 

You can also use the * sign to indicate part of the file name, and so on.

You can also add all the files in a crowd, and then eliminate ( unstage ) unnecessary ones, if you see that excluding fewer files than adding.

It was:

 $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: calc/index.php # modified: include/configs/keys.php # 

Executed the command:

 $ git reset calc/ Unstaged changes after reset: M calc/index.php 

It became:

 $ git status # On branch master # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # # modified: include/configs/keys.php # # Changes not staged for commit: # (use "git add <file>..." to update what will be committed) # (use "git checkout -- <file>..." to discard changes in working directory) # # modified: calc/index.php # $