How to avoid specifying absolute file path while git-add

前端 未结 6 681
名媛妹妹
名媛妹妹 2021-01-31 13:43

Using git add command becomes tedious once the file path becomes lengthy. For e.g. git add src_test/com/abc/product/server/datasource/manager/aats/DSManger.ja

6条回答
  •  迷失自我
    2021-01-31 14:19

    Here is another way to add files. Supported at the very least in git 1.7.1.

    $ git add -i
               staged     unstaged path
      1:    unchanged      +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
      2:    unchanged        +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
    
    *** Commands ***
      1: status       2: update       3: revert       4: add untracked
      5: patch        6: diff         7: quit         8: help
    What now> 2
    

    Press 2 to select update, or type u.

               staged     unstaged path
      1:    unchanged      +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
      2:    unchanged        +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
    Update>> 2
    

    Press the number corresponding to the file you want to stage. Separate multiple numbers with a comma, e.g. 1,2.

               staged     unstaged path
      1:    unchanged      +61/-61 a/very/long/path/that/we/really/dont/want/to/type.txt
    * 2:    unchanged        +1/-1 another/very/long/path/that/we/really/dont/want/to/type.txt
    Update>>
    

    Just press [enter] here.

    updated one path
    
    *** Commands ***
      1: status       2: update       3: revert       4: add untracked
      5: patch        6: diff         7: quit         8: help
    What now> q
    Bye.
    

    Finally type 7 or q to quit.

提交回复
热议问题