git-essentials

Provides Git commands and workflows for version control, branching, and collaboration.

Updated May 28, 2026
One-click install
npx skills add https://github.com/changfengpro/agent-skills --skill git-essentials-changfengpro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-essentials
Source: https://github.com/changfengpro/agent-skills/tree/main/skills/git-essentials
Command: npx skills add https://github.com/changfengpro/agent-skills --skill git-essentials-changfengpro

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Developers often struggle to remember the exact Git syntax for everyday tasks like branching, rebasing, stashing, and undoing mistakes, which slows down work and risks errors like accidental force pushes or lost commits. ## Core Features & Use Cases - Complete Command Reference: Covers setup, staging, committing, branching, merging, remotes, history, stashing, rebasing, tags, cherry-pick, submodules, and cleanup. - Ready-Made Workflows: Includes feature branch, hotfix, and fork-syncing workflows plus recovery recipes for common mistakes like accidental commits or deleted branches. - Use Case: You accidentally committed to the wrong branch and need to undo it without losing changes. Ask for the fix and get git reset --soft HEAD~1 along with the correct branch-switching steps. ## Quick Start Ask the assistant to show the Git commands for creating a feature branch, committing changes, and pushing it to a remote repository.

Frequently Asked Questions about git-essentials

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I undo the last Git commit without losing changes?

Use git reset --soft HEAD~1 to undo the last commit while keeping all changes staged. If you want to discard the changes entirely, use git reset --hard HEAD~1 instead.

How do I create and switch to a new Git branch?

Run git checkout -b feature-name or the modern git switch -c feature-name to create and switch in one step. Then push it with git push -u origin feature-name to set up tracking.

What is the difference between git merge and git rebase?

git merge combines branches by creating a merge commit and preserving history, while git rebase replays your commits on top of another branch for a linear history. Use git rebase -i HEAD~N for interactive cleanup before merging.

How do I recover a deleted Git branch?

Run git reflog to find the commit hash where the branch last pointed, then recreate it with git checkout -b branch-name <commit-hash>. The reflog tracks HEAD movements even after branch deletion.

Why is git push --force dangerous on shared branches?

Force pushing rewrites remote history and can overwrite teammates' commits, causing lost work. Use git push --force-with-lease instead, which fails safely if the remote has unexpected changes.