Skip to content

Instantly share code, notes, and snippets.

@dustinrjo
Last active October 28, 2025 21:49
Show Gist options
  • Save dustinrjo/1522acafbed7c016dde902f93a5d68a7 to your computer and use it in GitHub Desktop.
Save dustinrjo/1522acafbed7c016dde902f93a5d68a7 to your computer and use it in GitHub Desktop.
Spicy git speed runs
    _____ _ _   
   / ____(_) |  
  | |  __ _| |_ 
  | | |_ | | __|
  | |__| | | |_ 
   \_____|_|\__|

1. Local β†’ GitHub flow

mkdir <<your-repo-name>> && cd <<your-repo-name>>
git init && echo "node_modules/\n.DS_Store\n*.log\n.env" > .gitignore && git add . && git commit -m "Initial commit"
gh repo create your-repo-name --private --source=. --remote=origin --push

Drop --private for public repos.


2. New Feature Branch

git checkout main && git pull & git checkout -b <<feature-branch-name>>
git push -u origin <<feature-branch-name>>

The -u flag = create remote branch.


3. Rebase && PR

git checkout <<feature-branch-name>> && git pull
git fetch origin && git rebase origin/main

Fix conflicts 🀞

git push --force-with-lease
gh pr create --base main --head <<feature-branch-name>> --title "title" --body "description"

Or just gh pr create for interactive mode. ✨


4. Rebase Existing PR Branch

git checkout <<feature-branch-name>> && git pull && git fetch origin && git rebase origin/main && git push --force-with-lease

PR auto-updates. 🎯


Hotkeys πŸ”₯

git branch --show-current     # where am i
git branch -a                 # show me everything
gh pr status                  # what's cooking
git rebase --abort            # panic button

Pro tip: --force-with-lease is safer than --force. Skydiving vs base jumping.


Share freely. Fork liberally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment