Back to Basics

Basic Git Commands

The essentials for any technical interview.

CommandDescription
git initInitialize a new Git repository.
git clone [url]Download a repository from a remote source.
git statusShow the working tree status (staged/unstaged files).
git add [file]Add file(s) to the staging area.
git commit -m "[message]"Record changes to the repository.
git branchList, create, or delete branches.
git checkout -b [branch]Switch branches or restore working tree files (using -b creates a new branch).
git pullFetch from and integrate with another repository or a local branch.
git pushUpdate remote refs along with associated objects.
git logShow commit logs.