🐧 Linux TippsDebian 11 Long Term Support reaches end-of-life(31.08.2026 um 02:00 Uhr)
🐧 Linux TippsUpdated Debian 13: 13.7 released(12.09.2026 um 02:00 Uhr)
🕵️ SicherheitslückenUSN-8741-1: Flatpak vulnerabilities(10.09.2026 um 10:44 Uhr)
🕵️ SicherheitslückenUSN-8742-1: Netty vulnerability(10.09.2026 um 11:01 Uhr)
🕵️ SicherheitslückenUSN-8737-2: GNU C Library vulnerabilities(10.09.2026 um 13:25 Uhr)
🕵️ SicherheitslückenUSN-8743-1: PHP vulnerabilities(10.09.2026 um 13:48 Uhr)
🕵️ SicherheitslückenUSN-8744-1: Python vulnerabilities(10.09.2026 um 15:53 Uhr)
🐧 Linux TippsUSN-8748-1: Linux kernel (NVIDIA) vulnerabilities(10.09.2026 um 17:32 Uhr)
🕵️ SicherheitslückenUSN-8745-1: KissFFT vulnerabilities(10.09.2026 um 17:36 Uhr)
🕵️ SicherheitslückenUSN-8746-1: libEBML vulnerability(10.09.2026 um 17:48 Uhr)
🐧 Linux TippsDebian 11 Long Term Support reaches end-of-life(31.08.2026 um 02:00 Uhr)
🐧 Linux TippsUpdated Debian 13: 13.7 released(12.09.2026 um 02:00 Uhr)
🕵️ SicherheitslückenUSN-8741-1: Flatpak vulnerabilities(10.09.2026 um 10:44 Uhr)
🕵️ SicherheitslückenUSN-8742-1: Netty vulnerability(10.09.2026 um 11:01 Uhr)
🕵️ SicherheitslückenUSN-8737-2: GNU C Library vulnerabilities(10.09.2026 um 13:25 Uhr)
🕵️ SicherheitslückenUSN-8743-1: PHP vulnerabilities(10.09.2026 um 13:48 Uhr)
🕵️ SicherheitslückenUSN-8744-1: Python vulnerabilities(10.09.2026 um 15:53 Uhr)
🐧 Linux TippsUSN-8748-1: Linux kernel (NVIDIA) vulnerabilities(10.09.2026 um 17:32 Uhr)
🕵️ SicherheitslückenUSN-8745-1: KissFFT vulnerabilities(10.09.2026 um 17:36 Uhr)
🕵️ SicherheitslückenUSN-8746-1: libEBML vulnerability(10.09.2026 um 17:48 Uhr)

🔧 Programmierung 🕛 vor 3 Monaten 6 Min Lesezeit
0

Git Advanced: The Commands I Wish I Knew Earlier (2026)

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




Git Advanced: The Commands I Wish I Knew Earlier (2026)



Beyond add, commit, push. These are the Git commands that make you significantly more productive.






Rewriting History (Use with Care!)






CODE
# Modify your last commit (before pushing!)
git commit --amend -m "Better message"
# Add forgotten file to last commit:
git add forgotten-file.js
git commit --amend --no-edit # Keep same message, add the file

# Interactive rebase — edit/squash/reorder past commits
git rebase -i HEAD~5 # Edit last 5 commits
# Opens editor with:
# pick abc123 First commit
# pick def456 Second commit
# pick ghi789 Third commit
#
# Change 'pick' to:
# reword = Edit commit message
# squash = Merge into previous commit
# fixup = Merge into previous (discard message)
# edit = Pause for amending
# drop = Remove commit entirely

# Squash last 3 commits into one (non-interactive)
git reset --soft HEAD~3 && git commit -m "Combined message"

# Drop a specific commit from history
git rebase -i <commit-before-target> # Then change 'pick' to 'drop'









Stashing: Save Work Without Committing






CODE
# Basic stash (saves all changes, including untracked if -u)
git stash # Stash tracked changes
git stash -u # Also stash untracked files
git stash -p # Interactively choose what to stash

# List and apply stashes
git stash list # Shows all stashes
# stash@{0}: WIP on feature-branch: abc1234 message
# stash@{1}: WIP on main: def5678 other work

git stash pop # Apply most recent + remove from list
git stash apply # Apply but keep in list
git stash apply stash@{1} # Apply specific stash

# Create named stash for easy reference
git stash save "WIP: login feature"

# Show what's in a stash before applying
git stash show -p stash@{0} # See the actual diff!

# Drop/clear stashes
git stash drop stash@{0} # Remove one
git stash clear # Remove all stashes

# Practical workflow:
# You're working on feature A → urgent bug report comes in
git stash -u # Save all work
git checkout -b hotfix/bug # Switch to fix branch
# ... fix bug, commit, push ...
git checkout feature-a # Back to original work
git stash pop # Restore exactly where you were









Searching Through History






CODE
# Search commit messages
git log --grep="login" # Commits mentioning "login"
git log --grep="auth" --oneline --all # All branches, compact

# Search CODE content across all history
git log -S "functionName" --oneline # "Pickaxe" — find when string was added/removed
git log -G "pattern" --oneline # Find when regex pattern changed

# Search by author/date
git log --author="John" --since="2026-01-01" --until="2026-03-01"
git log --after="last week" --before="yesterday"

# Find which commit broke something (BINARY SEARCH!)
git bisect start
git bisect bad # Current version is broken
git bisect good v2.0 # This version worked
# Git checks out a middle commit automatically
# You test it, then run:
git bisect good # This commit works
git bisect bad # This commit is broken
# Repeat until Git finds the exact breaking commit!
git bisect reset # Done, go back to original branch

# Find a file's history
git log --follow -- file.txt # Track across renames!
git log -p --follow file.txt # Show full diffs too

# Who changed this line?
git blame file.txt # Show who wrote each line
git blame -L 10,20 file.txt # Only lines 10-20









Branching & Merging Mastery






CODE
# Create branch from specific point
git branch feature-x abc1234 # Branch starting at commit abc1234

# Rename branches
git branch -m old-name new-name
git branch -m new-name # Rename current branch

# Compare branches
git diff main...feature # Changes since branches diverged
git diff main..feature # Tip of main vs tip of feature
git log main..feature # Commits in feature not in main
git log main...feature # Symmetric difference (both ways)

# Clean up merged branches
git branch --merged # Branches already merged into current
git branch --merged | grep -v '\*' | xargs git branch -d # Delete them

# Recover deleted branch
git reflog # Find where the branch pointed
git checkout -b recovered-branch abc1234 # Recreate from SHA

# Cherry-pick specific commits
git cherry-pick abc123 # Apply one commit from another branch
git cherry-pick abc123 def456 # Multiple commits
git cherry-pick --no-commit abc123 # Apply changes without committing

# Merge strategies
git merge feature # Default (fast-forward or merge commit)
git merge --no-ff feature # Always create merge commit (preserves history)
git merge --squash feature # Squash all commits into one (no merge commit)









Working with Remotes






CODE
# See all remotes and their URLs
git remote -v
git remote show origin # Detailed info about origin

# Fetch without merging
git fetch origin # Get all updates
git fetch --prune origin # Remove local refs for deleted remote branches

# Push to different remote/branch
git push origin feature # Push current branch to origin/feature
git push origin HEAD:main # Push current branch TO main on remote
git push -f origin feature # Force push (⚠️ dangerous on shared branches!)

# Track a new remote branch
git checkout --track origin/new-feature
# Or shorter:
git checkout origin/new-feature

# Remove remote branch
git push origin --delete feature-branch
# Or:
git push origin :feature-branch

# Pull vs fetch + merge
git pull # fetch + merge (or rebase if configured)
git pull --rebase # fetch + rebase (cleaner linear history)
git pull --ff-only # Only fast-forward (rejects if would need merge)

# Sync with upstream (fork workflow)
git fetch upstream
git merge upstream/main # Integrate upstream changes









Troubleshooting Common Messes






CODE
# ❌ Committed to wrong branch
git reset --soft HEAD~1 # Undo commit, keep changes staged
git checkout correct-branch
git commit -c ORIG_HEAD # Reuse original commit message

# ❌ Accidentally pushed sensitive data (password, API key)
# Step 1: Remove from history IMMEDIATELY
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch secrets.env' \
--prune-empty --tag-name-filter cat -- --all
# Step 2: Force push (warn team first!)
git push origin --force --all
# Step 3: Rotate ALL compromised credentials immediately
# Better tool: BFG Repo Cleaner (faster than filter-branch)

# ❌ Merge conflict hell
# Don't panic. Systematic approach:
git status # See conflicted files
git diff # See the conflicts marked up
# Open files, look for: <<<<<<< HEAD, =======, >>>>>>> feature
# Edit to keep what you want, remove markers
git add resolved-file.js # Stage the resolution
git commit # Complete the merge

# Use a merge tool for complex conflicts:
git mergetool # Opens configured visual merge tool

# Abort if overwhelmed
git merge --abort # Go back to pre-merge state

# ❌ Detached HEAD state (made commits while detached)
git checkout main # Switch back (commits still there!)
git reflog # Find your detached commits
git cherry-pick abc1234 # Bring them to a real branch

# ❌ Need to undo something?
git restore file.txt # Discard working directory changes
git restore --staged file.txt # Unstage (keep changes)
git reset --hard HEAD~1 # Destroy last commit AND changes (⚠️ irreversible!)
git revert abc123 # New commit that undoes abc123 (safe for shared!)









Useful Aliases to Add Today






CODE
# Add these to ~/.gitconfig [alias] section:
[alias]
co = checkout
br = branch
ci = commit
st = status -sb
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
unstage = reset HEAD --
amend = commit --amend --no-edit
save = stash push -u
pop = stash pop
prune-all = !git branch --merged | grep -v '\\*|main|develop' | xargs git branch -d
cleanup = !git branch -vv | grep ': gone]' | awk '{print $1}' | xargs git branch -d
recent = branch --sort=-committerdate -v --list









Which Git command here is new to you? What's your favorite Git trick that wasn't included?



Follow @armorbreak for more practical developer guides.

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Debian 11 Long Term Support reaches end-of-life
1 Quelle
Updated Debian 13: 13.7 released
1 Quelle
USN-8741-1: Flatpak vulnerabilities
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Git Advanced: The Commands I Wish I Knew Earlier (2026)

Thematisch verwandte Begriffe: Advanced, Commands, Wish, Knew · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...