Back to Resources
Git Cheatsheet
The most commanding Git commands. Save this page to quickly remember how to manage your code history.
1. Setup & Initialization
git initInitialize a local repository in the current directory.git clone [url]Clone an entire repository from a remote server to your local machine.
2. Staging & Committing
git statusCheck the status of your files (untracked, modified, or staged).git add [file]Add a file (or `.` for all files) to the staging area to precisely define your commit.git commit -m "[descriptive message]"Commit your staged content as a new commit snapshot.
3. Branching
git branchList all local branches.git checkout -b [branch-name]Create a new branch and switch to it immediately.git merge [branch-name]Merge the specified branch's history into the current branch.
4. Remote Repositories
git remote add origin [url]Connect your local repository to a remote server.git pull origin branch-nameFetch and merge changes on the remote server to your working directory.git push origin branch-namePush your local history to the remote repository.