b-88vw
Last Updated: February 25, 2016
·
1.728K
· jjperezaguinaga
Me 180x180

Git add same name different folder files.

Sometimes I can't do git add . because I need to change staging variables (like port name, for instance) and I don't want those changes to be committed [1]. So I do this instead:

git status | awk '/modified/{print $3}' | grep NAME_FILE | xargs git add

This works in a project that looks something like this:

* specs
   ** login.js
   ** dashboard.js
   ** profile.js
* controllers
   ** loginCtrl.js
   ** dashboardCtrl.js
   ** profileCtrl.js
* services
   ** login-srv.js
   ** dashboard-srv.js
   ** profile-srv.js

Ignore the poor naming notation. Some people actually prefer wrap up their modules into one folders, which in this case would hade made more sense for me

* login
   ** spec
   ** controller
   ** service
* profile
   ** spec
   ** controller

<small>[1] Which is the problem to begin with. Your application should have a way to run development variables, or allow you to pick the staging ones</small>

Say Thanks
Respond