Was sind die Optionen von `git add -p`?

Lesezeit: 2 Minuten

Benutzeravatar von Hugolpz
Hugolpz

Ein tun git add -p Ich sehe einen Unterschied und die Liste der Auswahlmöglichkeiten:

~/workspace$ git add -p                                              
diff --git a/gulpfile.js b/gulpfile.js                                                 
index cf91028..c3a0964 100644                                                          
--- a/gulpfile.js                                                                      
+++ b/gulpfile.js                                                                      
@@ -57,7 +57,7 @@ gulp.task("pack", pack);                                             
 // Minify and concatenate all js libs                                                 
 gulp.task("libs", function() {                                                        
        return gulp.src([                                                              
-               "js/libs/trackjs.js",                                                  
+       //      "js/libs/trackjs.js",  // hidden due to noise but not the bug          
                "js/libs/q.js",                                                        
                "js/libs/jquery.js",                                                   
                "js/libs/cookie.js",                                                   
Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?

Was macht Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]? Optionen bedeutet ? Wo sind ihre Erklärungen zu finden?

  • Vielen Dank. Ich habe das blockiert.

    – Hugolpz

    30. Dezember 2015 um 10:24 Uhr

  • Es gibt ein nettes Video-Tutorial, das erklärt git add -p hier: johnkary.net/blog/…. Es ist die Zeit wert.

    – Quasoft

    17. Oktober 2016 um 17:15 Uhr


Wenn Sie tippen ? An der Eingabeaufforderung erhalten Sie die Erklärung.

Die Optionen sind insbesondere:

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

Falls Sie die gleiche Verwirrung wie ich erleben, fand ich das manchmal j,J,k,K Optionen haben nicht funktioniert, ich denken (habe aber nicht genug experimentiert, um sicher zu sein), dass sie nur innerhalb derselben Datei funktionieren, sodass Sie Hunks in derselben Datei überspringen können, aber nicht zur nächsten Datei springen und dann zur vorherigen zurückkehren.

1439670cookie-checkWas sind die Optionen von `git add -p`?

This website is using cookies to improve the user-friendliness. You agree by using the website further.

Privacy policy