This website works best with JavaScript enabled.
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

  • Back to home
  • Listen this article
  • Print this article
5 min read
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
Optimizing Performance in Go Applications with PGO

🍃 Related posts

  • Syncing_Git_Tags_image

    Syncing Git Tags across to other repositories

  • GitHub_Achievements_image

    Unlocking GitHub Achievement badges

  • GitHub_downloaded_specific_folder_img

    Download a specific folder on GitHub repository

Bookmark

Want to update?

Subscribe to my blog to receive the latest updates from us.

Monthly articles
New articles will be created every month.
No spam
All notifications are notified to you, not spam or advertising.

© Tran Nguyen Thuong Truong, 2024 - PRESENT