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

  • Home
  • SEARCH
  • 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 207831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:46:15+00:00 2026-05-11T17:46:15+00:00

I’ve just started using Git and it’s possible I’ve missed something obvious, but here

  • 0

I’ve just started using Git and it’s possible I’ve missed something obvious, but here goes:

  • I’m using msysgit 1.6.2.2 on Windows XP
  • While installing, I picked option 1 to “Use Git Bash only”

I’m trying to put together a wrapper script that I can use to replace the built in git diff with DiffMerge. Based on this thread on SO, I created the following batch file:

@echo off
REM ---- Switch forward slashes to back slashes ----
set oldW=%2
set oldW=%oldW:/=\%
set newW=%5
set newW=%newW:/=\%

REM ---- Launch DiffMerge ----
"C:/Programs/SourceGear/DiffMerge/DiffMerge.exe" /title1="Old Version" %oldW% /title2="New Version" %newW%

I placed the bat file under %GIT_INSTALL%/cmd and edited my .gitconfig file as follows:

[diff]
external = C:/Programs/git/cmd/git-diff-wrapper.bat

If i launch Git Bash and execute
git diff HEAD HEAD~ — myfile

I get a message File (\dev\null) not found – which given I’m on Windows is not surprising.

Pressing on, I launched gitk and under Edit>Preferences, I chose the same wrapper script. Trying the “external diff” option for a particular file gives the cryptic error message Unknown Option "

Clearly, I have no idea what I’m doing anymore so any help would be much appreciated.

  • 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-11T17:46:15+00:00Added an answer on May 11, 2026 at 5:46 pm

    I just experienced a somewhat similar experience with setting Notepad++ as my external editor with msysgit1.6.2.2.

    The key was to realize the wrapper was not a DOS script, but a /bin/sh script.

    So try to put in your “.bat” (even though it is not exactly a bat script, the extension is not important here):

    #!/bin/sh
    
    # diff is called by git with 7 parameters:
    # path old-file old-hex old-mode new-file new-hex new-mode
    
    "C:/Programs/SourceGear/DiffMerge/DiffMerge.exe" /title1="Old Version" "$2" /title2="New Version" "$5" | cat
    

    Do not worry about making all the ‘\‘ go ‘/‘: it is done by the Git scripts calling the external diff tool.

    I did not test it with DiffMerge, but with WinMerge, it works just fine, both from a DOS session or a Git Shell.

    #!/bin/sh
    "C:/Program Files/WinMerge/WinMergeU.exe" -e -ub "$2" "$5" | cat
    

    (with the ‘-e‘ option, I have just ot type on ‘ESC‘ to close and quit the diff tool: that works great!)


    alt textaverage_geek adds in the comments:

    added the ‘/bin/sh‘ header and tried running git diff again.
    This time the error is:
    Unexpected parameter 'C:/Docume~/avggeek/LOCALS~1/Temp/.diff_b08444
    Is there a way to see what are the parameters getting passed when I call git diff ?

    1/ There actually is a way to see what are the parameters getting passed!
    Add the following line in the C:\Program Files\Git\libexec\git-core\git-sh-setup file:

    git_editor() {
        : "${GIT_EDITOR:=$(git config core.editor)}"
        : "${GIT_EDITOR:=${VISUAL:-${EDITOR}}}"
        case "$GIT_EDITOR,$TERM" in
        ,dumb)
            echo >&2 "No editor specified in GIT_EDITOR, core.editor, VISUAL,"
            echo >&2 "or EDITOR. Tried to fall back to vi but terminal is dumb."
            echo >&2 "Please set one of these variables to an appropriate"
            echo >&2 "editor or run $0 with options that will not cause an"
            echo >&2 "editor to be invoked (e.g., -m or -F for git-commit)."
            exit 1
            ;;
        esac
    #### ADD THIS LINE BELOW
        echo >&2 "editor is ${GIT_EDITOR:=vi} $@."
    #### END ADDITION ABOVE
        eval "${GIT_EDITOR:=vi}" '"$@"'
    }
    

    You will see what editor is being called, with what parameter.

    Now, regarding the “Unexpected parameter” part:
    I did have the same kind of error when I called WinMergeU.exe with “/e /ub” instead of “-e -ub“, so first question is:
    Are you sure that the “/title1” bit could not be used as “-title1” or “-t1” or “--title1” or “--t1” ? That is what Is can see from the chapter 9 “Command Lines Arguments” of the pdf documentation of DiffMerge.
    If not, I suspect some double quotes are in order for delimiting properly the different parameters. Something like:

    "/title1="Old Version"" "$2" "/title2="New Version"" "$5"
    or
    "/title1=\"Old Version\"" "$2" "/title2=\"New Version\"" "$5"
    

    But my money would rather be on the “-title1” or “-t1” form:

    -t1="Old Version" "$2" -t2="New Version" "$5"
    

    should work just fine.

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

Sidebar

Ask A Question

Stats

  • Questions 114k
  • Answers 114k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You won't need to install anything, just deploy the files.… May 11, 2026 at 10:17 pm
  • Editorial Team
    Editorial Team added an answer To get the value of a field: getattr(obj, 'field_name') To… May 11, 2026 at 10:17 pm
  • Editorial Team
    Editorial Team added an answer In Python 2, if you have an iterator, you can… May 11, 2026 at 10:17 pm

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am currently running into a problem where an element is coming back from
Seemingly simple, but I cannot find anything relevant on the web. What is the
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
Is it possible to replace javascript w/ HTML if JavaScript is not enabled on

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.