I have a folder in my repository that contains a large number of files. If I have made changes to 20 files, and need to commit these files (say something like this)
$ git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: SWIFT/db/add_sub_2lh.tdf
deleted: SWIFT/db/add_sub_ape.tdf
deleted: SWIFT/db/add_sub_bmb.tdf
deleted: SWIFT/db/add_sub_kka.tdf
deleted: SWIFT/db/cmpr_e7g.tdf
deleted: SWIFT/db/mult_6ct.v
deleted: SWIFT/db/prev_cmp_swift.qmsg
deleted: SWIFT/db/swift.(0).cnf.cdb
deleted: SWIFT/db/swift.(10).cnf.cdb
deleted: SWIFT/db/swift.(10).cnf.hdb
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: SWIFT/altpll_50M.bsf
modified: SWIFT/altpll_50M.cmp
modified: SWIFT/altpll_50M.qip
modified: SWIFT/altpll_50M.v
modified: SWIFT/altpll_50M/altpll_50M_0002.v
modified: SWIFT/altpll_50M_sim/mentor/msim_setup.tcl
modified: SWIFT/altpll_50M_sim/synopsys/vcs/vcs_setup.sh
modified: SWIFT/altpll_50M_sim/synopsys/vcsmx/vcsmx_setup.sh
modified: SWIFT/greybox_tmp/cbx_args.txt
modified: SWIFT/output_files/swift.flow.rpt
What I want to do is only commit the files that are staged for commit. I do not want the "changes not staged for commit" to be committed. However when I run
git commit .
I see that all my changes are included in the commit.
If I use the -m option,I need to provide the file names, and I am not too keen to do that as the file names are all different and there are instances in my workflow, where the files may be in various nested folders
[EDIT]
If I use just
git commit
It will includes all the files that I have staged for committing in all the folders in the repository. I wish to commit only the files I have staged for committiing in the present folder or matching some pattern that I can specify on the command line