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
Git

Git: Fix a Merge Driver Being Ignored for One File Type

- 18.11.26 - ErcanOPAK

🔀 Git: Fix a Merge Driver Being Ignored for One File Type

A custom merge driver registered in .gitattributes only runs when Git actually performs a genuine three-way content merge on a matching file — if the file is flagged binary, or if only one side of the merge touched it at all (letting Git fast-forward that file’s change trivially), the driver is skipped entirely with no error, because there was never a real merge for it to resolve. A second, quieter failure mode is a pattern defined only in a local, uncommitted .git/info/attributes file, which never reaches collaborators who merge the same file type.

🔎 The Problem

# .gitattributes (committed)
*.strings merge=po-merge

# .git/config (local only, never committed)
[merge "po-merge"]
    driver = po-merge-tool %O %A %B %L

# A teammate without this [merge "po-merge"] block in their own
# config sees the SAME .gitattributes pattern, but Git has no driver
# registered under that name on their machine - falls back to the
# default merge instead of erroring.

✅ Fix: Verify the Attribute Matches and the Driver Is Actually Registered

  • Run git check-attr merge -- path/to/file to confirm the merge attribute genuinely applies to that file, rather than assuming the .gitattributes pattern matches the path you think it does.
  • Document the [merge "name"] config block as a required local setup step (or ship it via a committed .gitconfig plus core.attributesFile, or a repo setup script) so every collaborator actually has the driver registered, not just the attribute pattern.
  • Check whether the file is marked or detected as binary; a binary-flagged file never goes through a content-level merge driver at all, regardless of how correctly the driver itself is configured.

🚨 Why This Is Dangerous

  • A merge driver that’s silently skipped doesn’t fail loudly — it just lets Git’s default merge run instead, which can produce a result that looks plausible but quietly loses the format-aware resolution the custom driver existed to provide.

A merge driver you configured only locally isn’t a team’s merge driver yet — it’s a promise the repository makes that just one machine happens to be able to keep.

— Version Control Tip

Related posts:

Git Hooks Automation: Pre-commit Checks That Save Hours of Debugging

Git Hooks Automation: Pre-commit Checks That Save Hours of Debugging

Git: Fix a .gitignore Rule That Silently Stops Matching After a Tracked Folder Was Renamed With Only...

Git: Fix a .gitignore Rule That Silently Stops Matching After a Tracked Folder Was Renamed With Only...

Git: Use Git Bisect to Find Bugs with Binary Search

Git: Use Git Bisect to Find Bugs with Binary Search

Views: 5

Post navigation

WordPress: Fix the Classic Editor Toolbar Missing After an Update
JavaScript: Fix Array.sort Reordering Equal Items Unexpectedly

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

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,059)
  • Get the User Name and Domain Name from an Email Address in SQL (983)
  • How to add default value for Entity Framework migrations for DateTime and Bool (981)
  • Get the First and Last Word from a String or Sentence in SQL (861)
  • How to select distinct rows in a datatable in C# (856)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (658)
  • Add Constraint to SQL Table to ensure email contains @ (613)
  • Average of all values in a column that are not zero in SQL (571)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (549)
  • Find numbers with more than two decimal places in SQL (477)

Recent Posts

  • Visual Studio: Fix Quick Actions Hiding Behind a Stale Squiggle
  • Photoshop: Fix a Smart Filter Resetting After You Relink It
  • Ajax: Fix a Cancelled Request Still Updating Stale UI State
  • C#: Fix a Span Captured by a Lambda Throwing at Runtime
  • The AI Prompt That Converts a REST Endpoint Into a Typed SDK
  • Git: Fix a Worktree Locking a Branch Needed Somewhere Else
  • Asp.Net Core: Fix a Background Service Leaking Scoped Dependencies
  • SQL Server: Fix a Columnstore Index Fragmenting After Bulk Deletes
  • Docker: Fix a Container Losing Logs After a Restart Policy
  • Asp.Net Core: Fix Output Caching Serving a Stale Authorized Page

Most Viewed Posts

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

Recent Posts

  • Visual Studio: Fix Quick Actions Hiding Behind a Stale Squiggle
  • Photoshop: Fix a Smart Filter Resetting After You Relink It
  • Ajax: Fix a Cancelled Request Still Updating Stale UI State
  • C#: Fix a Span Captured by a Lambda Throwing at Runtime
  • The AI Prompt That Converts a REST Endpoint Into a Typed SDK

Social

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