Fundamentals 3 min read

Master Advanced Git Commands: Amend, Merge, Resolve Conflicts, and Bulk Delete Tags

Learn essential yet less‑frequent Git commands—including how to amend commits, combine multiple commits, swiftly resolve merge conflicts using ‘theirs’ or ‘ours’, and batch‑delete tags—complete with practical examples to streamline version control for projects of any size.

21CTO
21CTO
21CTO
Master Advanced Git Commands: Amend, Merge, Resolve Conflicts, and Bulk Delete Tags

Git is the most advanced distributed version control system, capable of handling projects from tiny to massive. Below are some useful less‑common commands.

Often we use Git, but sometimes we need more complex commands. If you forget them, bookmark this guide.

Amend a commit

To correct a typo or wrong information in the last commit, use: git commit --amend After editing the commit message, push forcefully:

git commit --amend
// ... edit your message
git push --force example-branch

Combine commits

If you have many commits with messy messages, you can squash them:

git reset --soft "HEAD~n"
# (~n means ~1, ~2, …)
git commit --amend

Quickly resolve conflicts

When merging, you can automatically accept all changes from the other side:

# Accept all theirs
git pull -X theirs
git checkout --theirs path/to/file

Or accept all your own changes:

# Accept all ours
git pull -X ours

Batch delete tags

When many tags accumulate, delete them in bulk:

git tag -d TAG1 TAG2 TAG3
git push REMOTE --delete TAG1 TAG2 TAG3
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

DevOpssoftware developmentGitcommand-lineVersion Control
21CTO
Written by

21CTO

21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.