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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:33:54+00:00 2026-05-13T05:33:54+00:00

I want to make changes to a file in my repo, then force git

  • 0

I want to make changes to a file in my repo, then force git to believe the file is unmerged and show up in git status like so:

# Unmerged paths:
#   (use "git reset HEAD <file>..." to unstage)
#   (use "git add <file>..." to mark resolution)
#
#       both modified:      lib/delayed/recipes.rb
#

That’s the entirety of my question. Read on for an explanation of why, since I know that’s the first thing that will be asked.

The purpose here is a bugfix for Piston which today leaves merge conflicts in the index where they are too easily overlooked.

The way piston update works with a Git repo is:

  • Clone the remote repo into a new temporary git repo
  • Checkout that temp repo to the last commit we saw (saved in .piston.yml)
  • Checkout our local repo (in a new branch) to the last commit where .piston.yml was updated
  • Copy our local repo’s files into the temp repo
  • Commit all changes in the temp repo (these are our local changes as of the last time we updated this vendored project)
  • Run git merge master in the temp repo to merge our local changes with the remote repo’s changes
  • IGNORE MERGE CONFLICTS(!) and copy all the files from the temp repo to our local repo
  • Commit those files (in our new temp branch) to our local repo
  • Checkout local repo back to our original starting point
  • Merge temp branch into local repo (adds any further changes we have made)

I expect to fix this problem by allowing the file with merge conflicts to be committed into the temp branch, but at the very end (after it runs git merge --squash) I want to tell git about the files that had a merge conflict in the temp repo.

  • 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-13T05:33:54+00:00Added an answer on May 13, 2026 at 5:33 am

    In Git file that has a merge conflicts has (usually) three versions in index, and a version in working area with diff3 -E / rcsmerge conflict markers. The versions in the index are stage 1 from common ancestor, stage 2 for “our” version, and stage 3 for “theirs” version. For unmerged file there is no version in stage 0 (you can use git update-index --unresolve to restore unmerged state by deleting stage 0).

    You would need to use git ls-files --stage or git ls-tree <commit> to get sha-1 identifiers of blobs (file versions) you want to put in index, or git hash-object -w <file> if you want to generate version of a file from scratch / from working area version. Then you use git update-index --index-info to put higher order stages into the index file (and git update-index --unresolve after this, or git update-index --force-remove prior to stuffing higher stages to remove stage 0 from index). You can re-generate file with merge markers in working area using git checkout --conflict=merge -- <file>.

    HTH (Hope That Helps)


    See also: “How to selectively recreate merge state?” thread on Git mailing list.

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

Sidebar

Related Questions

No related questions found

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.