Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid specifying absolute file path while git-add

Tags:

git

git-add

Using git add command becomes tedious once the file path becomes lengthy. For e.g. git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.java
Is it possible to bypass specifying absolute file path? May be using some kind of pattern or something?

I know that we can use git gui. But I want to do it using cmd line.

Thanks in advance for the inputs.

like image 742
Vaman Kulkarni Avatar asked Jun 06 '11 07:06

Vaman Kulkarni


People also ask

Does git add only tracked files?

adds both tracked and untracked files. Let's demonstrate this, by creating a file in the current directory as well as a file in a sub-directory. Now let's change into the sub-directory and run git add . If we run git status , we'll notice only the file in the sub-directory was added.

Should I always use git add?

The git add command adds new or changed files in your working directory to the Git staging area. git add is an important command - without it, no git commit would ever do anything.


1 Answers

For unix-like systems you can always use the star to point to files, e.g.

 git add *DSManager.java 

will include all DSManager.java files git can find within your source tree starting in your current working directory.

like image 107
Steffen Avatar answered Sep 22 '22 17:09

Steffen