Skip to content
  • Home
  • About
  • No Access
  • Privacy Policy
Bits of .NET
Bits of .NET
  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Tag: git recovery

Git

Git: Undo a Bad git reset –hard and Get Your Commits Back

- 30.08.26 - ErcanOPAK comment on Git: Undo a Bad git reset –hard and Get Your Commits Back

🔀 reflog = Your Undo Button You ran git reset –hard to the wrong commit, or a script did it for you, and every uncommitted change plus commits after that point appear gone. Before you recreate hours of work manually, check this first. 🐞 The Problem git reset –hard HEAD~5 # Meant to undo 1 […]

Read More
Git

Git: Recover a Deleted Branch in 10 Seconds Using reflog — Even After a Force Push

- 30.08.26 - ErcanOPAK comment on Git: Recover a Deleted Branch in 10 Seconds Using reflog — Even After a Force Push

🔀 Deleted ≠ Lost You deleted a branch, or force-pushed over one, and realized seconds later it had unmerged work. Panic sets in — but Git almost never actually loses your commits. It just loses the pointer to them. 🐞 The Problem git branch -D feature/important-work # Deleted branch feature/important-work (was a1b2c3d). # …and you […]

Read More
Git

Git Reflog: Recover Lost Commits and Rewrite History

- 23.08.26 - ErcanOPAK comment on Git Reflog: Recover Lost Commits and Rewrite History

🔄 Key Takeaways: Git reflog is your safety net. Recover lost commits, reset mistakes, and undo disasters. Made a mistake with git reset or rebase? Git reflog saves you. 🔍 Find Lost Commits # ✅ View reflog history git reflog # Output: # abc1234 HEAD@{0}: commit: Fix important bug # def5678 HEAD@{1}: rebase: finishing # […]

Read More
Git

Git: Use git reflog to Recover Lost Commits After Reset

- 15.02.26 - ErcanOPAK comment on Git: Use git reflog to Recover Lost Commits After Reset

Accidentally did git reset –hard and lost commits? Reflog keeps history of all HEAD movements. View Reflog: git reflog # Output: # abc1234 HEAD@{0}: reset: moving to HEAD~3 # def5678 HEAD@{1}: commit: Important feature ← Lost commit! # ghi9012 HEAD@{2}: commit: Bug fix Recover Lost Commit: # Option 1: Checkout specific commit git checkout def5678 […]

Read More
Git

Git: Undo Last Commit Without Losing Changes (3 Different Scenarios)

- 03.02.26 - ErcanOPAK comment on Git: Undo Last Commit Without Losing Changes (3 Different Scenarios)

Committed too early or to wrong branch? Here’s how to undo commits without losing your work, depending on whether you’ve pushed or not. Scenario 1: Undo Last Commit (Not Pushed Yet) # Keep changes in working directory (most common) git reset –soft HEAD~1 # Now your changes are uncommitted, ready to re-commit # Use case: […]

Read More
Git

Recover Deleted Git Commits Even After Hard Reset (It’s Not Gone)

- 01.02.26 | 01.02.26 - ErcanOPAK comment on Recover Deleted Git Commits Even After Hard Reset (It’s Not Gone)

Accidentally did ‘git reset –hard’ and lost hours of work? Your commits aren’t deleted – they’re just orphaned. Here’s how to find them. The Magic Command – Reflog: git reflog This shows every HEAD movement in your repository, even deleted commits. Output looks like: a1b2c3d HEAD@{0}: reset: moving to HEAD~3 e4f5g6h HEAD@{1}: commit: Added user […]

Read More
Git

Recover a Deleted Commit Without Panic

- 30.01.26 - ErcanOPAK comment on Recover a Deleted Commit Without Panic

Commit gone? Not really. git reflog git checkout <hash> Why Git never deletes immediately — it just forgets references.

Read More
Git

Why Git Rebase “Loses” Commits (It Doesn’t — You Did)

- 29.01.26 - ErcanOPAK comment on Why Git Rebase “Loses” Commits (It Doesn’t — You Did)

Commits aren’t deleted — they’re detached. What actually happens Rebase rewrites history Old commits lose branch references They become unreachable, not gone Recovery git reflog git checkout <lost-commit-hash> Lesson If Git feels scary, you’re missing the mental model, not commands.

Read More
November 2026
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
30  
« Oct    

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (653)
  • Add Constraint to SQL Table to ensure email contains @ (609)
  • Average of all values in a column that are not zero in SQL (570)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (547)
  • Find numbers with more than two decimal places in SQL (475)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit
  • SQL Server: Fix ROW_NUMBER Ties Reordering Between Identical Runs
  • C#: Fix an Enum HasFlag Returning True for the Zero Value
  • WordPress: Fix Featured Images Vanishing After a CDN Migration
  • Photoshop: Fix Content-Aware Fill Smearing a Repeating Pattern
  • Asp.Net Core: Fix Antiforgery Tokens Rejected Behind a Reverse Proxy

Most Viewed Posts

  • How to make theater mode the default for Youtube (1,055)
  • Get the User Name and Domain Name from an Email Address in SQL (981)
  • How to add default value for Entity Framework migrations for DateTime and Bool (977)
  • Get the First and Last Word from a String or Sentence in SQL (858)
  • How to select distinct rows in a datatable in C# (854)

Recent Posts

  • C#: Fix a ConditionalWeakTable Entry Vanishing Too Soon
  • Docker: Fix a Stale COPY Layer After Editing .dockerignore
  • Photoshop: Fix a Pattern Overlay Scaling Wrong on a High-DPI File
  • SQL Server: Fix a Computed Column Index Skipped by Implicit Cast
  • HTML5: Fix a required Input Inside a Hidden Tab Blocking Submit

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com