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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T01:02:14+00:00 2026-06-14T01:02:14+00:00

The context is, I’ve added some changes to a file using add -p and

  • 0

The context is, I’ve added some changes to a file using add -p and because of the way git was presenting the patches I can’t be sure the result will be good. I want to see the file as if I’d committed, then pushed, and then someone else had pulled the file. Not the diff, I just want to see that final version of the file. I need to preserve my changes to the current file, any clobbering of that file would be vexing to say the least!

The only way I can think to do this is:

  • Commit the changes.
  • Stash the rest.
  • If anything is amiss then either rollback the commit, or add in more commits and squash it.

The main problem I have with a rollback is that I’ll have to go through all the adding again. Squashing could be problematic too – it would just be easier if I could see the staged file in one piece before commit. Is this possible, or is there another “easy” way? (nothing arcane please, Git is already too arcane for me to get knee deep in just for this!)

  • 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-14T01:02:15+00:00Added an answer on June 14, 2026 at 1:02 am

    You can use git cat-file.

    $ git add -p my_file.c
    $ git cat-file blob HEAD:my_file.c
    

    Note that the path is relative to the top of the repository.

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

Sidebar

Related Questions

Context: Windows7, VBScript, ADODB and ADOX. I have written some VBScript code which creates
Context : python 2.6.5 environment I am using unittest.defaultTestLoader.loadTestsFromModule(module) to load tests. However, when
Context We have this application, using about 60 coding projects. We have several products
Context I'm learning C, and I'm trying to reverse a string in place using
Context Using Ruby I am parsing strings looking like this: A type with an
Context The case is screen scraping web content using QuotaXML SDK 1.6 to finally
Context: I downloaded a file (Audirvana 0.7.1.zip) from code.google to my Macbook Pro (Mac
Context: I'm working on Project Euler Problem 23 using Matlab in order to practice
Context: I have to add an online payment system, on a quite old PHP
Context Suppose I have protocols ICursor, IFoo, IBar then I can have a function

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.