Skip to content

Instantly share code, notes, and snippets.

@donabrams
Last active November 1, 2018 16:17
Show Gist options
  • Save donabrams/994de232f99f6f2bc3de87bb3dc2ed3b to your computer and use it in GitHub Desktop.
Save donabrams/994de232f99f6f2bc3de87bb3dc2ed3b to your computer and use it in GitHub Desktop.
Usable git (lets)

Goals:

  • Promote small commits
  • Promote rebasing (fewer merge commits)
  • Sensible defaults
  • Better merge conflict resolution and avoidance
  • Less git knowledge to know
> lets login $repo
# Steps you through logging into github and checks access by attempting the given repo
# Will automatically try ssh:// if git:// access is blocked

> lets get $repoOrBranch
# if in a git repo, checks out via the address and adds the remote.
# Otherwise, checks out the local or remote branch if it exists

> lets branch $branchName
# If it creates a new branch, automatically sets the "parent" branch to the current branch (to update from)

> lets prune [$branchName]
# asks you if you're sure
# deletes the local branch and prompts you to delete the remote branch if it exists
# then checks out the parent branch (if on that branch)

> lets see
# prints:
#  - current branch
#  - default remote
#  - if there are differences between local and remote
#  - if there are updates to the parent branch not merged in

> lets review
# shows the uncommitted changes on this branch compared to local

> lets share
# warns/stalls if there are local changes
# then pushes changes you have locally to the remote

> lets simplify
# allows you to re-organize existing commits
# allows you to split a single branch into multiple branches
# can also submit prs

> lets pr
# creates a pull request with the given branch and opens it in a new window (github/gitlab)

> lets update [$branchName]
# If no branchName and there are remote changes, merges in the remote branch with the same name
# then, if no branchName and there are changes to the parent branch, merges those in
# If remote branch differs from local, a warning/stall is shown and you can choose local or remote
# rebases by default (no merge commits)

> lets pretend this never happend
> lets undo
# displays and undoes the last "effectful" `lets` action (including effects on the remote)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment