Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

showing more context in git add

Tags:

git

For example, with git-diff I can do the following to show 10 surrounding lines of context when showing the diff.

git diff -U10

Can I do something similar with git-add --patch? Ideally I would like to to:

git add -p -U10

But I didn't find such option. Is there anything like this?

like image 964
nacho4d Avatar asked Jan 28 '14 08:01

nacho4d


People also ask

How do I show more lines in git diff?

git diff has the -U<n> option which allows you to customize the number of lines to show around a change. For example, git diff -U5 ... will show 5 lines of context.

Is git add necessary?

The git add command adds new or changed files in your working directory to the Git staging area. git add is an important command - without it, no git commit would ever do anything.


1 Answers

You can try:

git -c diff.context=10 add -p

If this works, you can make it permanent by using:

git config --global diff.context 10

This is the only thing I can find that might work.

like image 129
Ikke Avatar answered Sep 28 '22 02:09

Ikke