🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Expert Masterclasses.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.
Back to Resources

Git Commands

A quick reference for the most commonly used Git commands for version control and collaboration.

CommandDescriptionUsage
git initInitializes a new local Git repository in the current directory.git init
git cloneCopies an existing remote repository to your local machine.git clone <repository_url>
git addAdds changes from the working directory to the staging area.git add <file> or .
git statusShows the status of changes: what's staged, what isn't, and which files aren't being tracked.git status
git commitSaves a snapshot of the staged changes to the repository's history.git commit -m "Commit message"
git pushSends your local commits to the remote repository.git push origin <branch_name>
git pullFetches and downloads changes from a remote repository and updates the local branch.git pull origin <branch_name>
git branchLists, creates, or deletes branches.git branch <new_branch>
git checkoutSwitches to another branch or restores files from the working tree.git checkout <branch_name>
git mergeMerges a different branch into your current active branch.git merge <branch_to_merge>
git logShows the commit history for the current branch.git log
git remoteManages the set of tracked repositories (remotes).git remote -v
git diffShows the differences between commits, commit and working tree, etc.git diff
git stashTemporarily shelves modified, staged changes to work on something else.git stash