Search code examples
gitvisual-studio-codegit-commitgit-add

How to git stage an one by one the folder with files in Visual Studio Code?


I have a folder with other subfolders. Then in each subfolder many files (over 1000). I want to stage, commit each subfolder at a time (not all subfolders folders at once).

Do I have in VSCode a way to do this easly form interface? Because I do not want to add 1000 files one by one to click the + sign.


Solution

  • You can easily do this through the integrated terminal. You can choose to add and commit one directory at a time.

    git status */
    

    will show you unstaged/modified directories

    On branch master
    Your branch is up to date with 'origin/master'.
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
    
            img/test.txt
    
    nothing added to commit but untracked files present (use "git add" to track)
    

    From here you can stage your directories one at a time. This is a simple and quick way. Now you just commit every time after staging a directory.