2011-08-05 21 views
55

Sürümlü bir dosyanın birkaç satırını değiştirdiysem, hattındaki numaralı bir satırı komut satırı tarafından geri almak mümkün müdür?Tüm dosya yerine tek bir satıra ödeme yapmak mümkün mü?

Ben bütün bir dosya için yapacağını Tıpkı:

git checkout /path/to/file.extension 

ama böyle bir şey yaptığını bu mümkün

git checkout /path/to/file.extension --line 10 

demek?

cevap

85

Her bir iri ayrı ayrı görmek ve bunları kontrol edip etmeyeceğinize karar vermek için git checkout -p numaralı sayfaları kullanabilirsiniz (ve daha daraltmak istiyorsanız isteğe bağlı bir yol argümanı da alır). Matt'in cevap ayrıntılı için

24

, git checkout --patch -- <path argument> aşağıdaki seçeneklerle interaktif modu başlar:

y - stage this hunk 
n - do not stage this hunk 

q - quit; do not stage this hunk or any of the remaining ones 
a - stage this hunk and all later hunks in the file 
d - do not stage this hunk or any of the later hunks in the file 
g - select a hunk to go to 
/- search for a hunk matching the given regex 
j - leave this hunk undecided, see next undecided hunk 
J - leave this hunk undecided, see next hunk 
k - leave this hunk undecided, see previous undecided hunk 
K - leave this hunk undecided, see previous hunk 

s - split the current hunk into smaller hunks 
e - manually edit the current hunk 

? - print help 

yns ve e seçenekleri

başlamak için iyi bir yer vardır.

Ayrıca bakınız:

İlgili konular