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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T05:08:52+00:00 2026-05-30T05:08:52+00:00

I know that I have git add -p to manually choose what chunks to

  • 0

I know that I have git add -p to manually choose what chunks to add to the index. However, I am looking for a way to use the Git CLI API to programmatically add certain chunks.

Is this possible with the CLI or do I need API bindings for C# which I am using?

  • 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-30T05:08:53+00:00Added an answer on May 30, 2026 at 5:08 am

    I went and looked at how git add -p works. You don’t even want to know.

    Effectively, it parses the git diff output (actually git diff-files -p), and processes the diffs manually. It shows you a hunk, if you want it, it appends that to its running diff, and eventually runs git apply --cached with the generated diff.

    I’d strongly recommend using any API available to you over trying to convince this 1,600 line patch manipulation script to do what you want.

    Notable parts include the area around @hunk = coalesce_overlapping_hunks(@hunk) , where it’s just done processing the question loop for all the hunks, and is just about to compress them down into a diff for you, and around my %patch_modes = … where all the interaction with actual git tools is described; you can see how it’s built on just the commands I showed above.

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

Sidebar

Related Questions

I know that I have to use: rdtsc. The measured function is deterministic but
I know that exceptions have a performance penalty, and that it's generally more efficient
I have ten or more(i don't know) tables that have a column named foo
As a web developer I am using PHP and I know that I have
I'm trying to remove all of the leaves. I know that leaves have no
I know that most people have DirectX9-capable cards but is it really necessary to
I know that if I have the following group of numbers { 0, 1,
I know that I should have schema of a table before calling NewRow method
Now that I know C++ I want to get into desktop application that have
Does anyone know how sites that have a real-time feed of a lot of

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.