Git logo.

Advanced Git topics and commands

Advanced Git operations, from Stashing changes with git stash, and Tagging releases with git tag to Cherry-picking with git cherry-pick, Undoing commits with git revert and git reset.

The following is a quick guide of Advanced Git Topics. These include: Stashing changes with git stash, Tagging releases with git tag, Cherry-picking with git cherry-pick, Undoing commits with git revert and git reset.

Note: This article is about Git’s advanced topics and commands. For a General and introductory Git tutorial you can go to: Git tutorial: Version control from the ground up.


Stashing Changes (git stash)

git stash
# Switch branch, do some work, come back
git stash pop

Temporarily saves uncommitted changes so you can switch contexts.


Tagging Releases (git tag)

git tag v1.0.0
git push origin v1.0.0

Marks important points in history, like version releases.


Cherry-pick (git cherry-pick)

git cherry-pick abc123

Applies the changes from a specific commit to your current branch.


Undoing Commits (git revert & git reset)

git revert: Creates a new commit that undoes a specific commit.

git revert abc123

git reset: Resets your branch to a previous commit.

git reset --hard abc123

(Use cautiously in shared repos.)

Leave a Reply

Your email address will not be published. Required fields are marked *