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 3331994
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:38:28+00:00 2026-05-17T23:38:28+00:00

I have a script that works fine in one branch and is broken in

  • 0

I have a script that works fine in one branch and is broken in another. I want to look at the two versions side-by-side and see what’s different. Is there a way to do this?

To be clear I’m not looking for a compare tool (I use Beyond Compare). I’m looking for a Git diff command that will allow me to compare the master version to my current branch version to see what has changed. I’m not in the middle of a merge or anything. I just want to say something like

git diff mybranch/myfile.cs master/myfile.cs
  • 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-17T23:38:29+00:00Added an answer on May 17, 2026 at 11:38 pm

    git diff can show you the difference between two commits:

    git diff mybranch master -- myfile.cs
    

    Or, equivalently:

    git diff mybranch..master -- myfile.cs
    

    Note you must specify the relative path to the file. So if the file were in the src directory, you’d say src/myfile.cs instead of myfile.cs.

    Using the latter syntax, if either side is HEAD it may be omitted (e.g., master.. compares master to HEAD).

    You may also be interested in mybranch...master (from git diff documentation):

    This form is to view the changes on the branch containing and up to the second <commit>, starting at a common ancestor of both <commit>. git diff A...B is equivalent to git diff $(git-merge-base A B) B.

    In other words, this will give a diff of changes in master since it diverged from mybranch (but without new changes since then in mybranch).


    In all cases, the -- separator before the file name indicates the end of command line flags (mind the space between the separator and the filename). This is optional unless Git will get confused if the argument refers to a commit or a file, but including it is not a bad habit to get into. See Dietrich Epp’s answer to Meaning of Git checkout double dashes for a few examples.


    The same arguments can be passed to git difftool if you have one configured.

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

Sidebar

Related Questions

I have a custom jQuery script that works fine in all bowsers but one
I have the following code that works fine in IE: <HTML> <BODY> <script language=JavaScript>
I have an app that works fine. I'm trying to make one of the
I have a script that works fine, but I need to add a second
I have a php mail script that works well except for one minor fact.
I have a script that selects and drags several elements. It works fine but
I have a simple load more style script that works fine on the index
I have a script that works great. It is quite complex and does numerous
I have this script that works, but I need to change the format of
With help from you guys I now have a script that works like a

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.