Basic Git commands

Tyler Tyler (285)

There are some fundamental git commands that you will use frequently that are hard to work into a "how-to" guide. Here are some basic git commands and how to use them. These are in no specific order.

Here's everything you'll need to complete this guide:


git branch -v will show you all of your local branches, their commit messages, and which branch is checked out.

git status will show you the status of the branch you currently have checked out. Before you switch branches, merge, pull or push you want to make sure you have a clean working directory and you can check with git status.

git checkout -b branch_name will create a branch from the branch you currently have checked out, and it will be called "branch_name" or whatever you'd like to call it.

git add . is a useful command that will version control any new files and remove from version control any files that you've deleted. If you have a file that has been added to git that you have deleted from your repository, it won't be deleted from git until you use git add ..