ÔõÑùÔÚgitÖÐɾ³ý¿ÍÕ»ÖеÄÎļþ£¨°ì·¨Ç³Îö£©
ÔÚʹÓÃgitÖÎÀí´úÂëʱ£¬ÓÐʱÎÒÃÇÐèÒª´Ó¿ÍÕ»ÖÐɾ³ýһЩÎļþ¡£ÕâЩÎļþ¿ÉÄÜÊDz»ÐèÒªµÄ¡¢¹ýʱµÄ»òÕßÊDz»¶ÔÊʵġ£ÎÞÂÛÊÇÄÄÖÖÇéÐΣ¬ÎÒÃǶ¼ÐèÒª½«Æä´Ó¿ÍÕ»ÖÐɾ³ý¡£
ÏÂÃæÊÇÔõÑùÔÚgitÖÐɾ³ý¿ÍÕ»ÖеÄÎļþµÄ°ì·¨£º
1.Ê×Ïȶ¨Î»µ½ÒªÉ¾³ýµÄÎļþËùÔÚµÄĿ¼¡£¼ÙÉèҪɾ³ýµÄÎļþÃûΪ¡°test.txt¡±£¬¸ÃÎļþλÓÚ¡°/home/myproject¡±Ä¿Â¼Ï¡£
2.·¿ªÏÂÁîÐÐÖնˣ¬²¢Çл»µ½¸ÃĿ¼Ï¡£ÊäÈëÒÔÏÂÏÂÁ
cd /home/myproject
µÇ¼ºó¸´ÖÆ
ÊäÈëÈçÏÂÏÂÁʹÓÃgitµÄrmÏÂÁÎļþ´Ó¿ÍÕ»ÖÐɾ³ý£º
git rm test.txt
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁɾ³ýgit¿ÍÕ»ÖеÄtest.txtÎļþ¡£
µ±git rmÏÂÁîÍê³Éºó£¬ÎÒÃÇÐèÒª½«¶Ô¸ÃÎļþµÄÐÞ¸ÄÌá½»µ½¿ÍÕ»ÖС£¼´ÊäÈëÈçÏÂÏÂÁ
git commit -m "Remove test.txt file"
µÇ¼ºó¸´ÖÆ
Õ⽫Ìá½»¶Ôtest.txtÎļþµÄɾ³ý²Ù×÷µ½¿ÍÕ»ÖУ¬²¢Ìí¼ÓÒ»¸öÌá½»ÐÅÏ¢”Remove test.txt file”¡£
×îºó£¬ÎÒÃÇÐèÒª½«´úÂëÍÆË͵½Ô¶³Ì¿ÍÕ»£¬ÒÔʹµÃÆäËûÓû§¿ÉÒÔͬ²½É¾³ý¸ÃÎļþ¡£ÈôÊÇÄãÓÐÍŶӳÉÔ±£¬ÄãÐèҪ֪ͨËûÃǸÃÎļþÒѾ±»É¾³ý¡£
git push origin master
µÇ¼ºó¸´ÖÆ
ÒÔÉÏ°ì·¨Ö´ÐÐÍê±Ïºó£¬ÎÒÃǾÍÀֳɵؽ«test.txtÎļþ´Ó¿ÍÕ»ÖÐɾ³ýÁË¡£´Ëʱ£¬ÆäËûÓû§ÔÚ¸üпÍջʱ½«Í¬²½É¾³ý¸ÃÎļþ¡£
×ܽ᣺
ʹÓÃGitɾ³ý¿ÍÕ»ÖеÄÎļþºÜÊǼòÆÓ£¬Ö»ÐèҪʹÓá°git rm¡±ÏÂÁÎļþ´Ó¿ÍÕ»ÖÐɾ³ý£¬È»ºóÌá½»²¢ÍÆËÍÐ޸ģ¬¼´¿Éɾ³ýÏìÓ¦µÄÎļþ¡£ÔÚɾ³ýÎļþʱ£¬ÎÒÃÇÐèҪСÐÄÉóÉ÷£¬È·±£²»»áɾ´íÎļþ£¬ÒÔÃâ¶ÔÏîÄ¿Ôì³É²»Á¼Ó°Ï졣ͬʱ£¬ÎÒÃÇÒ²ÐèÒªÈÃÆäËûÈËÖªµÀ¸ÃÎļþÒѾ±»É¾³ý£¬ÒÔÃⱬ·¢³åÍ»»òÎó²Ù×÷¡£
ÒÔÉϾÍÊÇÔõÑùÔÚgitÖÐɾ³ý¿ÍÕ»ÖеÄÎļþ£¨°ì·¨Ç³Îö£©µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡