Roland Bengtsson
Roland Bengtsson

Reputation: 5158

Only add modified files in current dir with git?

Simple question. How can I just add modified and tracked files in the current directory to the repository ?

Suppose I have 3 modified files.

Utils/readme.txt
code/main.pas
code/feature.pas

The current dir is in code/. So I want to commit only main.pas and feature.pas file.

Upvotes: 5

Views: 5751

Answers (2)

wdh
wdh

Reputation: 1672

You could do:

git add -u /path/to/folder

However, that will add files in subdirectories of that folder as well, which might not be what you want. If you don't want subdirectories and you are in a bash shell, you can try:

git add /path/to/folder/*.*

That command will add any file in a folder as long as those files follow the standard name.extension naming convention.

Upvotes: 7

Matt Clark
Matt Clark

Reputation: 28609

To commit only already tracked files:

git add -u

This will also take any files that have been deleted, but will not add newly created files.

Upvotes: 4

Related Questions