How to…

Setting up

Get a repo from origin git clone <REPO URL>

Add remote origin

git remote add origin https://<repo>.git git push -u origin master

Checking out latest changes

git fetch
git checkout origin/master


Force-overwrite local files


View/add partial bits to the commit with a prompt yes/no git add -p

verbose commit, look at changes.Recommended git commit -v

git log git log --oneline --graph --decorate

git clean -fd # remove untracked


Remove untracked files (FORCE) git clean -f

Destroy local changes, but choose from patch git checkout -p

Git Ignore


Large files detected. You may want to try Git Large File Storage.



Create and switch to a new branch

git checkout -b 'mybranch'

Shorthand for

git branch mybranch
git checkout mybranch
git checkout master
git merge mybranch

Delete branch

git branch -d mybranch

Related pages