Skip to content

Git CLI Reference & Workflows

A practical reference of essential Git commands for tag management, history management, and multi-identity SSH configuration.


🏷️ Git Tags

# Create annotated tag
git tag -a v1.0.0 -m "Release version 1.0.0"

# Push tag to remote
git push origin v1.0.0

# Push all local tags
git push origin --tags

# Delete tag locally and remotely
git tag --delete v1.0.0
git push --delete origin v1.0.0

# Create a new branch starting from a tag
git checkout -b release-v1.0 v1.0.0

🧹 Git History Reset (Orphan Branch)

To reset commit history on a repository while keeping current files:

# 1. Create a fresh orphan branch
git checkout --orphan temp_branch

# 2. Stage and commit all files
git add -A
git commit -m "Initial commit"

# 3. Delete the old branch and rename current branch to main
git branch -D main
git branch -m main

# 4. Force push new clean history
git push --force origin main

⚙️ Configuration & SSH Customization

# Set repository-specific identity
git config user.name "Denny Vettom"
git config user.email "denny@vettom.com"

# Configure Git to use a specific SSH private key
git config core.sshCommand "ssh -i ~/.ssh/id_ed25519_custom -F /dev/null"