Create a .gitignore

Create a .gitignore

A .gitignore file is a list of files to ignore when pushing files to Github.com. It tells git which files should be ignored when changes are staged (added) and committed. Some files are commonly not tracked by git so they are not committed nor sent up to repositories. Sending and receiving too many files can slow down development and takes up unnecessary space.

From the Github specs...

The purpose of gitignore files is to ensure that certain files not tracked by git remain untracked.

Create a .gitignore file all your own:

These steps use vim to update the .gitignore file
  1. Navigate to the folder that contains the files for your project.
  2. If you have not yet created a .git file, run the git commit command.
  3. Create a .gitignore file by running touch .gitignore. The file name ".gitignore" is case sensitive and the name of the file matters. Git will look for a file with that name and will not stage (add) or commit files that is is told to ignore.
  4. Use vim to open the file by running vim .gitignore. This will open a text editor called "Vim" inside your console.
  5. Press the escape key to enter and exit text-entry mode.
  6. Once you have updated your .gitignore files you can save and exit vim by pressing escape, entering :wq, and pressing return/enter
Example:
# Don't track content of these folders
node_modules/
someOtherfoler/


# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so

*.so

# Packages #
############
# it's better to unpack these files and commit the raw source
# git has its own built in compression methods
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.zip

Other resources

.gitignore documentation: https://git-scm.com/docs/gitignore

Other Vim commands: https://www.howtoforge.com/vim-basics

Common .gitignore configurations: https://gist.github.com/octocat/9257657