Overview
This is a summary of the most important Git commands.
Code
Makes a clone of the repository at the specified URL (never clone a repository into another repository!)
Adds changes to the specified file to the staging area to be committed
Commits staged changes and allows you to write a commit message
Pushes local changes to the specified branch of the online repository
Advanced use cases
Add all files that have been changed
To add all files that have been changed to the staging area (to eventually commit them), use
That way, you don’t have to mention files individually.
Ignore files
You can create a .gitignore
file in the root directory of your repository to tell Git to stop paying attention to files you don’t care about.
For example, the following file will ignore any file within the my_passwords folder, as well as any csv-files (even if you call git add .
)!
my_passwords/*
*.csv
See also
-
Git Cheat Sheet - directly from the developers at GitHub
-
New to Git and GitHub? This Building Block walks you through how to set up Git step by step.