# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
# --- COMMIT END ---
# Type can be
# feat (new feature)
# fix (bug fix)
# refactor (refactoring production code)
# style (formatting, missing semi colons, etc; no code change)
# docs (changes to documentation)
# test (adding or refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
# --------------------
# Remember to
# Capitalize the subject line
# Use the imperative mood in the subject line
# Do not end the subject line with a period
# Separate subject from body with a blank line
# Use the body to explain what and why vs. how
# Can use multiple lines with "-" for bullet points in body
# --------------------
# For more information about this template, check out
# https://gist.github.com/adeekshith/cd4c95a064977cdc6c50
git
Adding a remote
Reinitialize your local repo; also clearing remote repos (ie origin):
$ git init
Then, will create 'origin' if it doesn't exist:
$ git remote add origin [repo-url]
Else, you can use the set-url subcommand to edit an existing remote:
$ git remote set-url origin [repo-url]
Also, you can check existing remotes with
$ git remote -v
Syncing a fork
Add remote(call it "upstream") from original repository in your forked repository.
Fetch the branches and their respective commits from the upstream repository. Commits to master will be stored in a local branch, upstream/master.
$ git fetch upstream
Check out your fork's local master branch.
$ git checkout master
Merge the changes from upstream/master into your local master branch. This brings your fork's master branch into sync with the upstream repository, without losing your local changes.
$ git merge upstream/master
Features
Command
Description
git clean -d -f .
Clear the untracked files from the local
git reset --hard upstream/master
Delete all your local changes to master
Branch & Merge
Command
Description
git branch
List branches (the asterisk denotes the current branch)
git branch -a
List all branches (local and remote)
git branch [branch name]
Create a new branch
git branch -d [branch name]
Delete a branch
git branch -D [branch name]
Delete a branch with --delete --force, which deletes the branch regardless of its push and merge status