This website requires JavaScript.
Essential_Git_commands_image

Essential Git commands every developer should master

Master Git like a pro with these powerful commands for commit management, branch operations, and workflow optimization

5 min read
Updated: Aug 05, 2025

🧪 Update Last Commit

Did you know? You can modify your most recent commit using this command:

git commit --amend -m "Updated message"

This command is incredibly useful when you:

  • Forgot to add a file
  • Added unnecessary files
  • Need to fix file content
  • Simply want to change the commit message

Amending commits helps you avoid creating new commits just to fix small mistakes from the previous one.

🥇 Top Professional commands

♻️ git revert

Purpose: Creates a new commit that undoes changes from a previous commit without deleting history.

When to use: Perfect for rollbacks while maintaining a clear commit history.

# Revert a specific commit
git revert abc1234

# Revert without creating a commit immediately
git revert --no-commit abc1234
📦 git stash

Purpose: Temporarily saves current changes without committing, allowing quick branch switches.

When to use: Essential when you're in the middle of work and need to handle urgent tasks on another branch.

# Stash current changes
git stash

# Stash with a message
git stash push -m "Work in progress on feature X"

# List all stashes
git stash list

# Apply the latest stash
git stash pop

# Apply a specific stash
git stash apply stash@{2}
🍒 git cherry-pick

Purpose: Selects a specific commit from another branch and applies it to the current branch.

When to use: Ideal for applying specific fixes from development to release branches without merging everything.

# Cherry-pick a single commit
git cherry-pick abc1234

# Cherry-pick multiple commits
git cherry-pick abc1234 def5678

# Cherry-pick without committing
git cherry-pick --no-commit abc1234

✨ Additional notions

  • git
  • github
Unlocking GitHub Achievement badges
Jul 07, 2025
Optimizing Performance in Go Applications with PGO
Jun 14, 2025

🍃 Related posts