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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:31:28+00:00 2026-06-14T20:31:28+00:00

I’m looking for a less rubbish way of doing this: git diff patch.DisableCreditCheck >

  • 0

I’m looking for a less rubbish way of doing this:

git diff patch.DisableCreditCheck > ~/patch
patch -p1 < ~/patch

ie. The changes from a branch as raw uncommitted changes.

The downside of patch is that it isn’t very clever; for example I often get “Reversed (or previously applied) patch detected! Assume -R[n]?” when there isn’t any previous patch, it just happens that there’s a set of filenames that it gets confused by.

It’d be much nicer to be able to do this:

git merge --no-commit --no-ff patch.DisableCreditCheck

…but that leaves you in a merge state, with no obvious way to get back to being in a normal state while preserving the changes.

Help! Any decent way of doing this?

(This is a very useful thing to be able to do when you’re sharing patches on the code youre working on; much MUCH better than having a set of patch files to pass around)

Edit: As an example of what I’m trying to achieve, lets say we have two branches, master, and config.me.

When I do git diff config.me > ~/patch; patch -p1 < ~/patch the result is:

$ git status
# On branch master
# Changes to be committed:
#   (use "git reset HEAD <file>..." to unstage)
#
#       modified:   Web/Web.config
#

This is the desired outcome… but without using patch, which doesn’t work well (specifically on windows it seems incredibly bad at detecting changes that should merge perfectly, but instead it’ll get confused and write out a bunch of .orig and .rej files).

So, like I said; I want the changes from a branch without the commits as local uncommitted changes.

  • 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-06-14T20:31:29+00:00Added an answer on June 14, 2026 at 8:31 pm

    Your first example shows that you don’t want the changes (i.e. commit deltas) of a particular branch, but rather you want your working-tree to reflect the latest state of that branch. (A subtle difference that can cause of confusion when trying to pick the right commands.)

    Few ways:

    Method 1:

    $ git checkout patch.DisableCreditCheck .
    

    This gets your working-tree to mirror patch.DisableCreditCheck. Changes between HEAD an patch.DisableCreditCheck are automatically staged. Word of caution: It’ll also blow away any uncommitted changes in your working-tree. (Note: that period (.) needs to be the path to the root of your working-tree.)

    Method 2:

    $ git read-tree patch.DisableCreditCheck
    

    This gets your index to mirror patch.DisableCreditCheck, but leaves your working-tree as is.

    Method 3:

    $ git checkout --detached patch.DisableCreditCheck
    $ git reset your-original-branch
    $ git checkout -B your-original-branch
    

    This is a silly method that’s roughly the same as Method 1. It’s included for academy and because it might be a little easier to follow.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.