← Home
Omar Hosney
LinkedIn
GitHub Gist

GitHub Gist (gh gist) Cheat Sheet 📝

Share code snippets, notes, and files instantly

📋 What is a Gist?

💡 Tip: Gists are great for sharing configuration files, scripts, and code examples!

🛠️ Prerequisites

⚠️ Note: Ensure your token has the gist scope enabled for gist operations.

✨ Create Gists

📖 View & List Gists

✏️ Edit Gists

💡 Tip: Set your preferred editor with gh config set editor "code --wait"

📥 Clone & Download

🗑️ Delete Gists

⚠️ Warning: Deleted gists cannot be recovered!

🔗 Gist URLs & IDs

🎯 Common Use Cases

📊 Command Reference Table

Command Description Key Flags
gh gist create Create a new gist -d, --desc, -f, --filename, -p, --public, -w, --web
gh gist list List your gists --public, --secret, -L, --limit
gh gist view View gist contents -f, --filename, -r, --raw, -w, --web
gh gist edit Edit a gist -a, --add, -d, --desc, -f, --filename, -r, --remove
gh gist clone Clone gist locally [directory]
gh gist delete Delete a gist --yes
gh gist rename Rename file in gist [old] [new]

🔧 Advanced Tips

🌐 Embedding Gists

💡 Tip: Embedded gists auto-update when you edit them on GitHub!

🔐 Public vs Secret

⚠️ Security: Never store sensitive data like passwords or API keys in gists!