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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:27:03+00:00 2026-05-27T21:27:03+00:00

My local tree has diverged from the master: $ git status # On branch

  • 0

My local tree has diverged from the master:

$ git status
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 7 and 3 different commit(s) each, respectively.
#
nothing to commit (working directory clean)

I tried git pull –rebase and failed:

$ git pull --rebase
First, rewinding head to replay your work on top of it...
Applying: * ...
Using index info to reconstruct a base tree...
Falling back to patching base and 3-way merge...
Auto-merging ChangeLog
CONFLICT (content): Merge conflict in ChangeLog
Failed to merge in the changes.
Patch failed at 0001 * ...

So I reverted with git rebase –abort and I am now at square 1.

What I want is:

  1. “Export” my 7 patches into human readable diff files (a la hg export).
  2. Make my tree a carbon copy of the origin/master (a la hg strip).
  3. re-apply my 7 patches one-by-one by hand (a la hg import).

I do understand that git rebase –continue does this.
I did it and it did work (after a few manual merges and a git add).
However, I want to be able to do that manually,
so I am wondering what are the git commands corresponding to the hg commands above.

Thanks.

PS. Please do not tell me that using a ChangeLog file with git is stupid.
Even if it is, it is not up to me.

  • 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-27T21:27:03+00:00Added an answer on May 27, 2026 at 9:27 pm

    There are, of course, several ways you could do this manually. You’ll still have the same conflicts because git is basically doing this for you under the hood. But if you want to do this manually, here are a couple of ways.

    First, export your commits as a series of patches. The easiest way to do this is using git format-patch:

    git format-patch -M @{upstream}
    

    will produce 7 patch files — one for each of your commits. (Note that “@{upstream}” is literal — it’s a not so well known feature of git.) This is better than capturing the output of git diff because all of the commit information (author, date, message, etc.) are preserved.

    Then you could reset your repository to match the upstream:

    git reset --hard @{upstream}
    

    Then you can re-apply your patches using git am — either one at a time or all at once.

    git am 0001-blah-blah.patch
    git am 0002-blah-blah.patch
    ...
    

    A second option would be to create a spare branch with your work on it:

    git branch scrap
    

    Then reset your branch to the upstream:

    git reset --hard @{upstream}
    

    Then cherry-pick the commits over:

    git cherry-pick scrap~6
    git cherry-pick scrap~5
    git cherry-pick scrap~4
    ...
    

    Then trash the scrap branch:

    git branch -D scrap
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I accidentially discard my changes on files in my local working tree via git
How do I delete untracked local files from the current working tree?
Does Git support any commands that would allow me to commit directly from a
My co-worker checked out our source tree from cvs and made some local changes,
I have a local git repository created with git svn clone . I make
Here's the scenario: I have a local git repository that mirrors the contents of
Python is installed in a local directory. My directory tree looks like this: (local
I have a small local network. Only one of the machines is available to
I have a set of documents based on a LaTeX template. Every document has
I have a program written in C that has to input and output JSON

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.