
Git Essentials
- 8 installs
- 33 repo stars
- Updated April 26, 2026
- bighardperson/computer-science-skills-collection
git-essentials is a skill providing essential Git commands and workflows for version control, branching, and collaboration.
About
git-essentials is a reference of core Git commands for version control, branching, and collaboration. A developer uses it to look up commands for staging, committing, branching, merging, remotes, history, undoing changes, stashing, rebasing, and tags. It also includes common workflow recipes for feature branches, hotfixes, and syncing a fork.
- Cheat sheet of essential Git commands across setup, branching, remotes, and history
- Includes undo, stash, rebase, tags, and submodule sections
- Common workflow recipes for feature, hotfix, and fork syncing
Git Essentials by the numbers
- 8 all-time installs (skills.sh)
- Ranked #443 of 735 Git & Pull Requests skills by installs in the Skillselion catalog
- Data as of Jul 30, 2026 (Skillselion catalog sync)
git-essentials capabilities & compatibility
Free; requires only the git binary
- Capabilities
- git workflow · git reference
- Works with
- github
- Use cases
- documentation
- Pricing
- Free
What git-essentials says it does
Essential Git commands and workflows for version control, branching, and collaboration.
Essential Git commands for version control and collaboration.
**Feature branch workflow:**
npx skills add https://github.com/bighardperson/computer-science-skills-collection --skill git-essentialsAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 8 |
|---|---|
| repo stars | ★ 33 |
| Last updated | April 26, 2026 |
| Repository | bighardperson/computer-science-skills-collection ↗ |
What it does
Look up essential Git commands and workflow recipes for setup, branching, remotes, and undo operations.
Who is it for?
Looking up standard Git commands and common workflow recipes.
Skip if: AI-generated commits or GitHub-API operations.
When should I use this skill?
You need a quick reference for a Git command or workflow.
What you get
The correct Git command or workflow recipe is provided from a reference cheat sheet.
- Git command references
- Workflow recipes
By the numbers
- 3 common workflow recipes (feature, hotfix, fork sync)
Files
Git Essentials
Essential Git commands for version control and collaboration.
Initial Setup
# Configure user
git config --global user.name "Your Name"
git config --global user.email "your@email.com"
# Initialize repository
git init
# Clone repository
git clone https://github.com/user/repo.git
git clone https://github.com/user/repo.git custom-nameBasic Workflow
Staging and committing
# Check status
git status
# Add files to staging
git add file.txt
git add .
git add -A # All changes including deletions
# Commit changes
git commit -m "Commit message"
# Add and commit in one step
git commit -am "Message"
# Amend last commit
git commit --amend -m "New message"
git commit --amend --no-edit # Keep messageViewing changes
# Show unstaged changes
git diff
# Show staged changes
git diff --staged
# Show changes in specific file
git diff file.txt
# Show changes between commits
git diff commit1 commit2Branching & Merging
Branch management
# List branches
git branch
git branch -a # Include remote branches
# Create branch
git branch feature-name
# Switch branch
git checkout feature-name
git switch feature-name # Modern alternative
# Create and switch
git checkout -b feature-name
git switch -c feature-name
# Delete branch
git branch -d branch-name
git branch -D branch-name # Force delete
# Rename branch
git branch -m old-name new-nameMerging
# Merge branch into current
git merge feature-name
# Merge with no fast-forward
git merge --no-ff feature-name
# Abort merge
git merge --abort
# Show merge conflicts
git diff --name-only --diff-filter=URemote Operations
Managing remotes
# List remotes
git remote -v
# Add remote
git remote add origin https://github.com/user/repo.git
# Change remote URL
git remote set-url origin https://github.com/user/new-repo.git
# Remove remote
git remote remove originSyncing with remote
# Fetch from remote
git fetch origin
# Pull changes (fetch + merge)
git pull
# Pull with rebase
git pull --rebase
# Push changes
git push
# Push new branch
git push -u origin branch-name
# Force push (careful!)
git push --force-with-leaseHistory & Logs
Viewing history
# Show commit history
git log
# One line per commit
git log --oneline
# With graph
git log --graph --oneline --all
# Last N commits
git log -5
# Commits by author
git log --author="Name"
# Commits in date range
git log --since="2 weeks ago"
git log --until="2024-01-01"
# File history
git log -- file.txtSearching history
# Search commit messages
git log --grep="bug fix"
# Search code changes
git log -S "function_name"
# Show who changed each line
git blame file.txt
# Find commit that introduced bug
git bisect start
git bisect bad
git bisect good commit-hashUndoing Changes
Working directory
# Discard changes in file
git restore file.txt
git checkout -- file.txt # Old way
# Discard all changes
git restore .Staging area
# Unstage file
git restore --staged file.txt
git reset HEAD file.txt # Old way
# Unstage all
git resetCommits
# Undo last commit (keep changes)
git reset --soft HEAD~1
# Undo last commit (discard changes)
git reset --hard HEAD~1
# Revert commit (create new commit)
git revert commit-hash
# Reset to specific commit
git reset --hard commit-hashStashing
# Stash changes
git stash
# Stash with message
git stash save "Work in progress"
# List stashes
git stash list
# Apply latest stash
git stash apply
# Apply and remove stash
git stash pop
# Apply specific stash
git stash apply stash@{2}
# Delete stash
git stash drop stash@{0}
# Clear all stashes
git stash clearRebasing
# Rebase current branch
git rebase main
# Interactive rebase (last 3 commits)
git rebase -i HEAD~3
# Continue after resolving conflicts
git rebase --continue
# Skip current commit
git rebase --skip
# Abort rebase
git rebase --abortTags
# List tags
git tag
# Create lightweight tag
git tag v1.0.0
# Create annotated tag
git tag -a v1.0.0 -m "Version 1.0.0"
# Tag specific commit
git tag v1.0.0 commit-hash
# Push tag
git push origin v1.0.0
# Push all tags
git push --tags
# Delete tag
git tag -d v1.0.0
git push origin --delete v1.0.0Advanced Operations
Cherry-pick
# Apply specific commit
git cherry-pick commit-hash
# Cherry-pick without committing
git cherry-pick -n commit-hashSubmodules
# Add submodule
git submodule add https://github.com/user/repo.git path/
# Initialize submodules
git submodule init
# Update submodules
git submodule update
# Clone with submodules
git clone --recursive https://github.com/user/repo.gitClean
# Preview files to be deleted
git clean -n
# Delete untracked files
git clean -f
# Delete untracked files and directories
git clean -fd
# Include ignored files
git clean -fdxCommon Workflows
Feature branch workflow:
git checkout -b feature/new-feature
# Make changes
git add .
git commit -m "Add new feature"
git push -u origin feature/new-feature
# Create PR, then after merge:
git checkout main
git pull
git branch -d feature/new-featureHotfix workflow:
git checkout main
git pull
git checkout -b hotfix/critical-bug
# Fix bug
git commit -am "Fix critical bug"
git push -u origin hotfix/critical-bug
# After merge:
git checkout main && git pullSyncing fork:
git remote add upstream https://github.com/original/repo.git
git fetch upstream
git checkout main
git merge upstream/main
git push origin mainUseful Aliases
Add to ~/.gitconfig:
[alias]
st = status
co = checkout
br = branch
ci = commit
unstage = reset HEAD --
last = log -1 HEAD
visual = log --graph --oneline --all
amend = commit --amend --no-editTips
- Commit often, perfect later (interactive rebase)
- Write meaningful commit messages
- Use
.gitignorefor files to exclude - Never force push to shared branches
- Pull before starting work
- Use feature branches, not main
- Rebase feature branches before merging
- Use
--force-with-leaseinstead of--force
Common Issues
Undo accidental commit:
git reset --soft HEAD~1Recover deleted branch:
git reflog
git checkout -b branch-name <commit-hash>Fix wrong commit message:
git commit --amend -m "Correct message"Resolve merge conflicts:
# Edit files to resolve conflicts
git add resolved-files
git commit # Or git merge --continueDocumentation
Official docs: https://git-scm.com/doc Pro Git book: https://git-scm.com/book Visual Git guide: https://marklodato.github.io/visual-git-guide/
{
"ownerId": "kn7anq2d7gcch060anc2j9cg89800dyv",
"slug": "git-essentials",
"version": "1.0.0",
"publishedAt": 1769692045864
}{
"version": 1,
"registry": "https://clawhub.ai",
"slug": "git-essentials",
"installedVersion": "1.0.0",
"installedAt": 1776069967129
}
Related skills
FAQ
What Git topics does git-essentials cover?
Setup, staging, branching, merging, remotes, history, undo, stash, rebase, tags, submodules, and clean.
What does the skill require?
The git binary, per its metadata requires.bins.