Git Commands
Find the right Git command for your workflow
Basics
git init
Initialize a new Git repository
git init
git clone
Clone a repository into a new directory
git clone https://github.com/username/repository.git
Staging
git add
Add file contents to the staging area
git add . # Add all files git add file.txt # Add specific file
Committing
git commit
Record changes to the repository
git commit -m "Your commit message"
Branching
git branch
List, create, or delete branches
git branch # List branches git branch new-feature # Create branch git branch -d branch-name # Delete branch
Remote
git push
Update remote refs along with associated objects
git push origin main
git pull
Fetch from and integrate with another repository or local branch
git pull origin main
Merging
git merge
Join two or more development histories together
git merge feature-branch