Zum Hauptinhalt springen
tsecurity.de LIVE
Echtzeit-Radar & Feeds
Alle RSS Feeds
👥 Community & Social
Windows Tipps & SecurityGarmin Cirqa im Test: Fitness-Tracker ohne Display(22.09.2026 um 10:30 Uhr)
Windows Tipps & SecuritySicher online bezahlen: 7 Methoden im Praxis-Check(22.09.2026 um 09:00 Uhr)
Sichere Programmierunghas_tokens: true is a boolean. 476 of 791 have no market behind them.(22.09.2026 um 10:00 Uhr)
Sichere ProgrammierungClaude Code Hooks – Safety Through Invariants(22.09.2026 um 10:04 Uhr)
Sichere ProgrammierungYour MCP Tool Just Returned a Secret. Did It Need To?(22.09.2026 um 10:05 Uhr)
Windows Tipps & SecurityGarmin Cirqa im Test: Fitness-Tracker ohne Display(22.09.2026 um 10:30 Uhr)
Windows Tipps & SecuritySicher online bezahlen: 7 Methoden im Praxis-Check(22.09.2026 um 09:00 Uhr)
Sichere Programmierunghas_tokens: true is a boolean. 476 of 791 have no market behind them.(22.09.2026 um 10:00 Uhr)
Sichere ProgrammierungClaude Code Hooks – Safety Through Invariants(22.09.2026 um 10:04 Uhr)
Sichere ProgrammierungYour MCP Tool Just Returned a Secret. Did It Need To?(22.09.2026 um 10:05 Uhr)
Intelligence View
⚡ tsecurity.de Intelligence

How to Undo a Git Commit Without Losing History

We've all been there — you made a commit, pushed it, and then realized: that was a mistake. The good news? Git has a safe way to undo it without rewriting history. The Problem You might think of using git reset to go back in t…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

We've all been there — you made a commit, pushed it, and then realized: that was a mistake.



The good news? Git has a safe way to undo it without rewriting history.






The Problem



You might think of using git reset to go back in time. But if you've already pushed the commit to a shared branch, resetting and force-pushing can cause problems for everyone else on the team.






The Better Way: git revert



git revert creates a new commit that undoes the changes from a previous commit. Your history stays intact — you just add an undo step on top.






How to Do It



Step 1: Find the commit you want to undo




git log --oneline






You'll see something like:




a8636a4 Tailor portfolio for e-commerce role
d56677a Fix hover effect
5315182 Add new project






Copy the hash of the commit you want to revert (e.g. a8636a4).



Step 2: Revert it




git revert a8636a4 --no-edit








  • a8636a4 — the commit hash you want to undo


  • --no-edit — skips the editor and uses the default revert message



Git will create a new commit like:




bf880c5 Revert "Tailor portfolio for e-commerce role"






That's it. Your mistake is undone and your history is clean.






When to Use git revert vs git reset




























git revert git reset
Creates a new commit Yes No
Safe for shared branches Yes No
Rewrites history No Yes


Rule of thumb: If the commit is already pushed, use git revert. If it's only local, git reset is fine.






Summary






# See your commits
git log --oneline

# Revert the one you don't want
git revert <commit-hash> --no-edit






Simple, safe, and no drama. That's the Git way.

Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Undo a Git Commit Without Losing History

Thematisch verwandte Begriffe: Undo, Commit, Without, Losing · 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 ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-59815 | Joplin is an open source note-taking and to-do application that organise…
Advisory →
TTS Reader • tsecurity.de Voice
tsecurity.de Icon
tsecurity.de App
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
🔖 Gespeicherte Artikel
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel Rechts: nächster Artikel unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...

Zurück: vorheriger Vor: nächster
↗ Original-Quelle
Social Reaktionen Deine Reaktion zählt
Einstufung & Relevanz-Poll 0 Stimmen
In sozialen Netzwerken teilen 1-Klick