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
References:
Force-overwrite local files
Committing
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
Cleaning
Remove untracked files (FORCE)
git clean -f
Destroy local changes, but choose from patch
git checkout -p
Git Ignore
- https://github.com/github/gitignore
- Mac: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
Issues
Large files detected. You may want to try Git Large File Storage.
Advanced
Branching
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