Basic Git Commands

By admin ·
1

git branch -v

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

2

git status

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.

3

git checkout -b branch_name

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.

4

git add .

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 ..