Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

How to push your files in folder to git

I just completed Git Basic course and was hoping to know how to upload selective folder in my web projects to repo at GitHub. There are million of files in my folder but i want selective files/folder to be uploaded.

1 Answer

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Ammar;

Are you looking at only having certain files/folder in a project on a consistent basis or will it change for each push?

If, for example, you have items you will never want pushed, but are a part of your local project you can make a .gitignore file and git will, yup you guessed it, ignore them. Very useful for things like local settings, security info, etc. An accepted practice if there are files that someone else might need to work on your project is to include sure information in a README.md file in your project root.

Hope it helps.
Ken

Question is how, a example would be good.

Ken Alger
Ken Alger
Treehouse Teacher

Like I mentioned, create a .gitignore file. List the files and folders inside it that you do not want tracked by git. Keep the .gitignore file in the root directory of your project and they won't be tracked.

For example, if you don't want a password.json file and a my_settings folder included in git tracking, your .gitignore would look something like:

password.json
my_settings/

If you have additional questions, you can take a look at the gitignore Documentation

Happy coding,
Ken