Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6710891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:04:31+00:00 2026-05-26T08:04:31+00:00

I’d like to be able to invoke some pre-processing on files before Git tries

  • 0

I’d like to be able to invoke some pre-processing on files before Git tries to merge them, and the post-process the merged result. The general idea here is that some files are difficult to automatically merge as-is, but can be converted to an easier form for processing. Here’s my concrete use case:

I have a repository of mostly not-very-sensitive data. Within that repository, I have a little bit of encrypted sensitive data, in a file called sensitive.pgp. I like this arrangement because I don’t have to trust that my repository is being managed securely, I just have to trust the encryption and the password. The catch of course it that Git can’t possibly merge encrypted text, so if sensitive.pgp is modified in two checkouts at once, there’s no merging available — even if the changes to the clear text are easily separated. The manual work-flow is like this:

  1. Merge conflict for sensitive.pgp detected.
  2. Start git-mergetool. Tool fails to merge PGP files, too.
  3. Now I have temporary files for my version, the base version, and the remote version.
  4. Decrypt all three files.
  5. Invoke my merge tool on the decrypted versions.
  6. Encrypt the result.
  7. git-add the new sensitive.pgp.

I’d like to tell Git to apply my pre- and post-processing before it even tries to merge, so it can handle this automatically. I can imagine lots of other scenarios with the same general pattern: Pretty much any time you have a compressed file format with a text-like underlying structure (e.g. PDF, OpenOffice, Word), for example.

Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:04:32+00:00Added an answer on May 26, 2026 at 8:04 am

    You have a few options:

    1. define a checkout/checkin filter in .gitattributes (see git help attributes) that decrypts the files at checkout (leaving them unencrypted in your working tree) and encrypts them before checking in
    2. define a custom merge driver (see git help attributes and the merge.<driver>.* options in git help config)
    3. define a custom merge tool (see git help mergetool and the mergetool.<tool>.* options in git help config) that decrypts before invoking the real merge tool and encrypts when the real merge tool returns

    You can configure git to only apply custom filters and merge drivers to specific files, but the merge tool applies to the whole repository unless you limit it by passing file names to the git mergetool command. You can design your custom merge tool to change its behavior depending on the name of the file being merged.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have some data like this: 1 2 3 4 5 9 2 6
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
I'm trying to create an if statement in PHP that prevents a single post
I want to count how many characters a certain string has in PHP, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.