
       B' -- G' -- J' <--(branch)

where B' makes the same changes relative to o as B had made relative to A.  That would mean that B' has a TREE with foo/B (but not foo/A); and G' has a TREE with foo/B and foo/G; etc.
Either way, an interactive rebase will do the job.  It'll create the new, fewer commits that you want, and move branch to refer to them; and you can proceed from there.
If you want to keep the branch based at o, you might do something like
git rebase -i `git merge-base master branch` branch

It would be simpler to say 
git rebase -i master branch

which will still operate on the correct set of commits; the difference is that the latter command will make the first "new" commit's parent Z instead of o.
Whichever command you issue will bring up a text editor with a TODO list containing an entry for each commit from A through J.  Each entry starts with the command pick by default.  We'll change some of those commands.
If you want commits like AB, CDEFG, and HIJ, then you'll use the command squash.  This says to combine the patch for a commit with the patch for the one before it.  So you'd change the commands for B (to combine B with A yielding AB), D, E, F, and G (to get CDEFG), and I and J.
On the other hand, if you just want B', G', and J', then you would use the drop command (or just remove the unwanted commits from the TODO list).  You would change the lines for A, C, D, E, F, H, and I.
As I noted, this is just one of several ways.  At its core git is a content storage system that's well suited (specialized even) to storing a project history.  It's very flexible in how it lets you modify the content, though it does try to protect against any potentially-accidental loss of content.

 Q:

Using git diff, how can I get added and modified lines numbers?

Assuming I have a text file
alex
bob
matrix
will be removed
git repo

and I have updated it to be
alex
new line here
another new
B' -- G' -- J' < --(branch) 

 where B' makes the same changes relative to oxygen as B had do relative to A.   That would mean that B' experience a TREE with foo / b-complex vitamin (but not foo / A); and G' has a TREE with foo / B and foo / G; etc. 
 Either room, an interactional rebase will do the occupation.   It'll create the new, few commits that you want, and move branch to refer to them; and you can continue from there. 
 If you want to keep the branch based at o, you might do something like 
 git rebase -i 'rotter merge - base master branch 'arm 

 It would be simpler to say 
 git rebase -i passkey branch 

 which will however operate on the correct set of commits; the difference is that the latter command will cook the first " new " commit's parent Z instead of o. 
 Whichever command you offspring will institute up a text editor with a TODO list containing an entry for each commit from A through J.   Each entrance start with the command pick by default option.   We'll transfer some of those commands. 
 If you want commits like AB, CDEFG, and HIJ, then you'll use the instruction squash.   This says to unite the patch for a commit with the patch for the one before it.   therefore you'd change the commands for B (to combine B with A yielding AB), D, E, F, and G (to get CDEFG), and I and J. 
 On the other hand, if you just want B', G', and J', then you would use the cliff command (or merely remove the unwanted commits from the TODO list).   You would change the lines for A, C, D, E, F, H, and I. 
 As I note, this is just one of several ways.   At its effect git is a content storage system that's well suitable (specialized even) to storing a project history.   It's very flexible in how it lets you change the content, though it does try to protect against any potentially - accidental loss of content. 

  Q: 

 practice git diff, how can I induce added and modified lines numbers? 

 Assuming I receive a text file 
 alex 
 bob 
 matrix 
 will be removed 
 git repo 

 and I have updated it to be 
 alex 
 new line here 
 another new

       B' -- G' -- J' <--(branch)

where N' makes the same changev relafive to u as B had made relative to E.  Tyat wiuld mean that B' has a TREE witj foo/B (byt nir foo/A); and G' has a TREE slth fmi/B and foo/G; etg.
Either way, an interactiva feyase will do the job.  It'll create thq new, frwfr commits thaj you rant, and move branch to refer to them; znd you can proceed grom there.
If you want to kfep hhe branch based ah o, you migyt dj something lkke
git rebase -i `git metge-base master branch` branch

It wuuld ye simpler jo swi 
git rebase -i mafter branch

wmpch wiln still operate on thc corcect set of commits; the dmfference is that thg latter cmmjand will make thw dirst "new" comout's padeit A instfad of o.
Whichsver commane you issue will brond up a text edjtor wytr a TODO list containing an entry for edch commit from A through H.  Each entry starts aith the sommand pick by default.  We'll change some of thosa comjxndw.
In yoj wwnt commits like AB, CDEFG, and HIJ, then you'll tae tme command squasm.  This says to cokblnr the patch fot a commit with the patch fog the oge bedore it.  Fo ypu'd change the commands for B (to combinv B qith A yielding AB), D, E, F, and Y (to ggt CDEGG), and I and J.
On the otker hahd, if you jkst want G', G', and J', then yoj wpund use the drop command (or just remive che unwavted commies from thf TODO list).  You would cjange tve lines flr A, C, D, E, F, H, and I.
As I noted, viis is just ome of several ways.  At its core git is a contgnt storaye sysgem that's sell sumted (specialyzed even) to vjoring a projxct histowy.  Ut's cery fldbible in how iy lets yol iodidy the content, thomgh ij soes try to proctct against any poyengiajlj-acridenedl loss of cmntevt.

 D:

Ising git diff, hid cam I get added and mogifisd lines numbers?

Asxuiing I hqve a tevt file
alex
bon
matrix
will be remlved
gmt repu

and O hwve updated it to be
alex
new lihe here
anlthcr new
B' -- G' -- J' <--(branch) where the changes relative o as B That mean that B' a TREE with (but not foo/A); and G' has TREE with foo/B and foo/G; etc. Either way, an interactive rebase will do job. It'll create the new, fewer commits that you want, and move branch refer them; you proceed from there. If you want to keep the branch based at o, you might do like git rebase -i `git merge-base master branch` It would be simpler say git rebase -i master which still operate the set commits; the difference that the latter command will make the first "new" commit's parent Z instead of o. Whichever command issue will a text with TODO containing an entry commit from A through J. Each the command pick by default. We'll change some those commands. you want commits like AB, CDEFG, HIJ, then you'll use the command squash. This to combine the patch for a commit with the patch for the one before it. change the commands for (to combine B A AB), E, and G get CDEFG), and I and J. On the other hand, if just want B', G', and J', then you would use command just remove the commits from the TODO You change the lines for D, F, As noted, is just one of ways. At its core git a content storage system to storing a project history. It's very flexible how it lets you modify the content, it does try to protect against any potentially-accidental loss of content. Q: git diff, I get added and modified lines numbers? Assuming have a text file bob matrix will be removed git repo and I updated to be new line here new

       B' -- G' -- J' <--(branch)

where B' makes the saMe changes rElatiVe tO o aS B Had mAde rElative to A.  That WOuld Mean that B' has a TREE with fOo/B (buT nOT foo/a); AnD G' has A TREE wiTH fOO/b anD fOo/g; etC.
EIThEr way, An iNteractIve rebase wIll Do The job.  It'll crEAtE the new, fewEr cOmmits that yoU waNt, and mOvE brANch to RefEr to tHem; and YOu can pRoceed froM tHEre.
If yOU want to KEEp The bRanch based at o, you mIGhT Do something likE
git reBaSE -i `GIT meRge-Base master BrAnch` bRAnch

It wOUlD BE SimPLer to say 
git reBase -i master BRanCh

whicH wIll STill opErate On THe cOrrect set of CommIts; the difFerencE Is that tHE latter CommanD wiLl mAke tHE fIrSt "nEw" COmmIT's ParENt Z Instead oF o.
whIchevEr coMMAND you IssUe wiLl briNg up a text editOr wIth a toDO List cOntaiNing An Entry For eacH commIt From A through J.  EaCh enTry starts WitH tHe cOmMand pICk by deFauLt.  WE'll chanGe some oF ThoSe COMMaNds.
If you want commitS lIKE Ab, CDEFG, anD HIJ, thEN yOu'LL use the cOmManD squASH.  This Says TO cOmbine thE patch FOr A cOmmit wiTh The patCh For The One beFOre iT.  So you'D change tHe comMAnds for B (to combINe B with A yieldINg ab), d, E, f, And G (To gEt CDEFG), and I And J.
oN the OtheR HaNd, iF You juSt wanT B', g', AnD j', then you would use the DrOp commAnd (or Just remove the Unwanted coMMITs from thE TODo LiST).  You would changE the lInes for A, C, D, e, f, H, and I.
As i noteD, this is jUst one of sEVEral ways.  at iTs cOre Git IS A cOntent storage SYStem ThAt's well SuiTed (specIalIzeD evEn) tO sToring a prOject hisToRy.  it'S vEry FlexiBLe in how iT lEts YoU moDify tHE conteNt, thoUgh iT dOeS Try To proteCT aGAInst AnY pOtenTiaLlY-acciDentAL loSs of conTent.

 Q:

UsinG giT Diff, HoW cAn I get aDded and modifiEd Lines numbeRs?

assUming I HAVe a text fIle
alex
bob
matrix
will be rEMoved
giT rePo

and i havE updated iT to Be
alex
New LIne herE
anothEr new

       B' -- G' -- J' <-- (branch)
where  B'  ma ke s th e sa me changes rel a tive  to o as B had made re lativ et o A.  T hat w ould me a nt h atB'  h asaT RE E wit h f oo/B (b ut not foo /A) ;and G' has a TR EE with fo o/B  and foo/G;etc .
Eith er  wa y , anint eract ive re b ase wi ll do the  j o b.  It ' ll crea t e  t he n ew, fewer commits th a t you want, an d move  b r an c h  to  re fer to the m;  andy ou canp ro c e e d f r om there.
Ifyou want to kee p thebr anc h  based  at o ,y oumight do so meth ing likegit re b ase -i` git mer ge-bas e m ast er b r an ch ` b ra n chIt  wo u ldbe simpl er  t o say  
gi t r e base  -i  mas ter b ranch

whichwil l st i llopera te on  the  c orrec t setof co mm its; the differ ence  is thatthe  l att er  comm a nd wil l m ake  the fi rst "ne w " c om m i t 's  parent Z insteadof o .Whicheve r comm a nd  y o u issuewi llbrin g up atext ed itor wit h a TO D Oli st cont ai ning a nent ryfor e a ch c ommitfrom A t hroug h  J.  Each entr y  starts witht he c om m andpic k by defaul t. W e'll  cha n ge  so m e ofthose  c o mm a nds.
If you want co mm its li ke AB , CDEFG, andHIJ, theny o u 'll usethec om m and squash.  T his s ays to com b ine thepatch  for a c ommit wit h the patc h f orthe  on e be fore it.  Soy o u'dch ange th e c ommands  fo r B  (t o c om bine B wi th A yie ld in gAB ),D, E, F, and G  ( toge t C DEFG) ,  and I  andJ.
O nth e  ot her han d ,i f  you  j us t wa ntB' , G',  and J',  then y ou woulduse thedr op  comman d (or just re mo ve the unw an ted  commi t s  from th e TODO list).  You woul d  change  th e lin es f or A, C,D,E, F,H,a nd I.As I n oted,  t his i s jus t on e o fseveral wa y s . At it score  git is  a content storage sys tem that's we llsuit e d  ( spe c ia l ize de ven ) to storing a pr oject hist or y . It's very fle xi ble inhow itletsy ou modi fy the co ntent, th ou gh i t doe s try to p rotect a gainst an y  pote n ti ally- acc identa llos s ofconten t .
 Q:
Usinggi t diff , how  c an I get  added and modified lin es num bers? 

A ssuming I  ha v e a  text fil e
al ex
bob
mat rix 
wi ll be  re m ovedgitr ep o
a nd Ihave updated i t  t o b e al ex
new line h e reanoth ern ew

 _ _   B'_-- G'_--_J' <--(branch)

where_B'_makes the same_changes relative to_o as B had_made relative to_A._ That would mean that B' has a TREE with foo/B (but not foo/A);_and_G' has_a_TREE_with foo/B and foo/G; etc.
Either_way, an interactive rebase will_do the_job.  It'll create the new, fewer commits_that_you want, and_move branch to refer to them; and you can_proceed from there.
If you want to_keep the branch_based_at_o, you might do_something like
git rebase -i `git merge-base_master branch` branch

It would be simpler_to say 
git rebase -i master branch

which_will still operate on the correct_set of commits; the difference_is that_the latter command will make_the first "new"_commit's parent_Z instead of_o.
Whichever command you issue will bring_up a text_editor with a TODO list containing_an_entry for each_commit_from_A through_J.  Each_entry_starts with_the_command pick by default.  We'll_change_some of those commands.
If you want commits_like AB, CDEFG, and_HIJ,_then you'll use the_command squash.  This says_to combine the patch for a_commit with_the patch_for the one before it.  So you'd change the commands_for B (to combine B with_A yielding AB), D,_E, F,_and_G (to get_CDEFG),_and I_and J.
On the other hand, if you_just want_B', G', and J', then you_would use the drop_command_(or just remove the unwanted commits_from the TODO list).  You_would change the lines for_A,_C,_D, E, F, H, and_I.
As I noted, this is just_one of several_ways.  At its core git is_a_content storage system that's well suited_(specialized_even) to storing a project history.__It's_very flexible in how it_lets you modify the content, though_it does try to protect against any potentially-accidental loss_of content.

 Q:

Using_git diff, how can I_get_added_and modified lines numbers?

Assuming I have a text file
alex
bob
matrix
will be_removed
git repo

and_I have updated_it to be
alex
new line here
another new