2015-12-30 62 views
0

做一個git add -p我看到了一個diff和選擇列表:`git add -p`有什麼選擇?

~/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,?]? 

什麼Stage this hunk [y,n,q,a,d,/,j,J,g,e,?]?選擇意味着什麼?哪裏可以找到他們的解釋?


編輯:這個問題是begginers但它阻止我,可以幫助其他人。感謝您的答案。

+5

輸入'?'....... –

+0

謝謝。我阻止了這一點。 – Hugolpz

+0

這裏有一個很好的視頻教程來解釋'git add -p':http://johnkary.net/blog/git-add-p-the-most-powerful-git-feature-youre-not-using-yet/ 。這是值得的。 – quasoft

回答

4

如果在提示時輸入?,則會得到解釋。

具體選項有:

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 

如果您遇到同樣的困惑是,我發現,有時候j,J,k,K選項沒有工作,我覺得(但還沒有足夠的實驗來可以肯定)他們只能在同一個文件中工作,所以你可以跳過同一個文件中的hunk,但不跳到下一個文件,然後回到前一個文件。

+0

感謝您的信息。 – Hugolpz

相關問題