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 trialRex Orioko
3,234 Points.gitignore
Can someone explain the .gitignore file to me please, what is it for, why use it, is it manually created or automatically created with the build system when setting up a dev environment.
2 Answers
Ari Misha
19,323 PointsHiya Rex! Its generated automatically but most of the times its an empty file. For last few days , i've been working on Ruby-on-Rails. And it comes with default .gitignore file and of course its empty. But i'd like to show ya the content of this file:
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
# Ignore Byebug command history file.
.byebug_history
Like the extension ".gitignore" and above documentation suggests, if you'd like explicitly ignore a file whilst "version controlling" your application or project, you can mention 'em files with relative path in this file and everything else will be handled behind the scenes. Git has three files: tracked, untracked and ignored.
tracked - a file which has been previously staged or committed;
untracked - a file which has not been staged or committed; or
ignored - a file which Git has been explicitly told to ignore.
I hope it helped. (:
Shardly Romelus
Full Stack JavaScript Techdegree Graduate 20,788 PointsHi Rex, I know it's been a while since you asked this question probably you're well versed in this topic by now. Here a link to a treehouse course on npm that explains gitignore. https://teamtreehouse.com/library/managing-dependencies-in-the-packagejson-file