Git Commands Flashcards
Learn all the git commands
Initialize a local Git repository
git init
Create a local copy of a remote repository
git clone
Check status
git status
Add a file to the staging area
git add [file-name.txt]
Add all changes to the staging area
git add -A
Add new files and modifications, without deletions to the staging area
git add .
Commit changes
git commit -m “I am message”
Remove a file or folder
git rm -r [file-name.txt]
List branches
git branch
List all branches (local and remote)
git branch -a
Create a new branch
git branch [branch name]
Delete a branch
git branch -d [branch name]
Delete a remote branch
git push origin –delete [branch name]
Create a new branch and switch to it
git checkout -b [branch name]
Clone a remote branch and switch to it
git checkout -b [branch name] origin/[branch name]