Git Basics

8 years ago

Checking Git Status

git status

Adding all changed files for commit

git add -A

Committing Files

git commit -m “my commit message”

Pushing files to remote repo

git push -u my-repo master

Get all branches

git fetch --all

Git merge

git checkout dev
git pull origin dev
git merge my-feature-branch
git push origin dev

Get clean version and reset local files

git checkout dev
git reset --hard HEAD
git clean -f -d
git pull

Delete all local branches, except for dev

git branch | grep -v "master" | xargs git branch -d
Discuss on Twitter