3

Follow-up from Git: ability to stage a certain file content without touching the working tree:

I want to modify the index of one (text) file by staging a patch (against HEAD) without having to change the working tree file state. Is this possible?

1
  • It is unclear to me what you want. You mean you want the index modified but not the working tree? What is the eventual goal? Commented Dec 21, 2011 at 10:17

1 Answer 1

4

You want git apply --cached

From the man page:

 --cached Apply a patch without touching the working tree. Instead take the cached data, apply the patch, and store the result in the index without using the working tree. This implies --index. 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.