GitLabÉÏÔõôһ´Îɾ³ý¶à¸öÎļþ
git labÊÇÒ»¸ö¿ªÔ´µÄ°æ±¾¿ØÖÆϵͳ£¬ÆäÖаüÀ¨¶Ô´úÂëµÄ×·×Ù¡¢±¸·ÝºÍÐ×÷µÈ¹¦Ð§¡£ÔÚʹÓà git lab ¾ÙÐдúÂëÖÎÀíʱ£¬¿ÉÄÜ»áÓöµ½ÐèҪɾ³ý¶à¸öÎļþµÄÇéÐΡ£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ gitlab ÉÏÒ»´Îɾ³ý¶à¸öÎļþ¡£
°ì·¨ÈçÏ£º
°ì·¨1£ºÊ¹Óà Git ÏÂÁîÐÐģʽµ¼º½µ½ Git ¿ÍÕ»ËùÔÚλÖá£
ÔÚ Windows ϵͳÖУ¬Ê¹Óà PowerShell ·¿ªÖնˣ¬È»ºóÇл»µ½ Git ¿ÍÕ»ËùÔÚµÄĿ¼¡£
°ì·¨2£ºÊ¹Óà Git status ÏÂÁî¼ì²éÎļþ״̬¡£
ÔÚ Git ¿ÍջĿ¼ÏÂÔËÐÐÒÔÏÂÏÂÁ
git status
µÇ¼ºó¸´ÖÆ
¸ÃÏÂÁ·µ»ØÒ»¸öÓÐ¹Ø Git ¿Íջ״̬µÄ¸ÅÊö£¬°üÀ¨ËùÐè²Ù×÷µÄÎļþÁÐ±í¡£Êä³öÓ¦ÀàËÆÓÚÏÂÃæµÄʾÀý£º
On branch master Your branch is up-to-date with 'origin/master'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) deleted: file1.txt deleted: file2.txt no changes added to commit (use "git add" and/or "git commit -a")</file></file>
µÇ¼ºó¸´ÖÆ
´ËÊä³öÌåÏÖÓÐÁ½¸öÎļþÒѾ׼±¸ºÃ´Ó Git ¿ÍÕ»ÖÐɾ³ý¡£
°ì·¨3£ºÊ¹Óà Git rm ÏÂÁîɾ³ýÎļþ¡£
ÏÂÃæµÄÏÂÁî¿ÉÒÔÒ»´Îɾ³ý¶à¸öÎļþ£º
git rm file1.txt file2.txt
µÇ¼ºó¸´ÖÆ
ÈôÊǽöÐèҪɾ³ýÒ»¸öÎļþ£¬ÔËÐÐÒÔÏÂÏÂÁ
git rm file1.txt
µÇ¼ºó¸´ÖÆ
ÔÚÈ·¶¨Ìύ֮ǰ£¬ÇëÓà Git status È·ÈÏ׼ȷµÄÎļþÒѱ»É¾³ý¡£
°ì·¨4£ºÊ¹Óà Git commit ÏÂÁîÌá½»¸ü¸Ä¡£
ʹÓà Git commit ÏÂÁîÌá½»¸ü¸Ä£¬²¢°üÀ¨ÓйØɾ³ýÎļþµÄ×¢ÊÍ£º
git commit -m "Deleted files: file1.txt and file2.txt"
µÇ¼ºó¸´ÖÆ
ÔÚÌá½»ºó£¬Git ½«É¾³ýÒÑɾ³ýµÄÎļþ¡£
×ܽ᣺
ͨ¹ýÒÔÉÏ°ì·¨¿ÉÒÔÇáËÉÔÚ Git Lab ÉÏÒ»´Îɾ³ý¶à¸öÎļþ¡£ÒÔÏÂÊÇһЩ³£¼ûÎÊÌâµÄ½â¾ö¼Æ»®£º
ÈôÊÇÎļþÒѾ±»Ìá½»µ½ Git ¿ÍÕ»ÖУ¬Ôò±ØÐèʹÓà Git revert ÏÂÁÒÔ·´×ªÌá½»²¢É¾³ýÎļþ¡£
ÈôÊÇÎļþ¼ÐÖеÄÎļþÐèÒª±»É¾³ý£¬Ôò±ØÐèʹÓôøÓеݹéÑ¡ÏîµÄ Git rm ÏÂÁÀýÈ磺
git rm -r folder-name
µÇ¼ºó¸´ÖÆ
×îºó£¬Òª×¢ÖØ Git rm ÏÂÁî´Ó Git ¿ÍÕ»ÖÐÓÀÊÀɾ³ýÎļþ£¬Òò´ËÔÚɾ³ý֮ǰ£¬È·±£ÒѾ×öºÃÐëÒªµÄ±¸·Ý¡£
ÒÔÉϾÍÊÇGitLabÉÏÔõôһ´Îɾ³ý¶à¸öÎļþµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡