Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add or commit specific files without specifying their full path?

Tags:

git

I have a lot of files after git status. Is there any way to commit specific subset without manually specifying every file's path in this subset.

like image 809
Yanis Urbis Avatar asked Oct 21 '25 11:10

Yanis Urbis


2 Answers

You can commit all files by doing a git add . or just specifying the directory that they're in: git add ./folder/ or to add all files that begin with "test": git add test*

like image 76
Nick Rucci Avatar answered Oct 23 '25 00:10

Nick Rucci


Adding the files without specifying their path (at least implicitly by using wildcards for example) in not possible, anyway, you can use wildcards to do this (matching text patterns, not only matching fix text).

Some suggestions:

Add all the changes: git add . (including the tracked files).

Add all tracked changed files: git add -a

Add all files and sub folders in a folder: git add PathToFolder/Folder
or use the relative path depending on Git repository root: git add ./RelativePath/Folder.

Add all C# files: *.cs

Add all files including text: git add *YourText* (maybe this is what you want, no need to specify the path, just any common string in files names!)

like image 38
Mohammed Noureldin Avatar answered Oct 23 '25 00:10

Mohammed Noureldin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!