Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git, how to commit only a specific directory?

Tags:

git

github

in my rails app I have a /public/assets directory. I'm writing a rake task to compile and push assets. After all the assets are generated I want to checkin and push ONLY the assets folder to github.

I have been using:

git add .
git commit -a -m "assets"
git push

Any ideas on how I can update this to only check-in and push /public/assets ?

Thanks

like image 611
AnApprentice Avatar asked Oct 24 '25 19:10

AnApprentice


1 Answers

Should be simple:

git add public/assets
git commit -m "assets"
git push

Please note that this only works, when you didn't stage (add) any other files prior to committing.

like image 130
Koraktor Avatar answered Oct 26 '25 09:10

Koraktor



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!