gitÔõôÉó²éÄÄЩÎļþ±»ÐÞ¸Ä
ÔÚʹÓÃgit¾ÙÐа汾¿ØÖƵÄÀú³ÌÖУ¬ÓÐʱ¼äÎÒÃÇÐèÒªÉó²éÄÄЩÎļþ±»ÐÞ¸ÄÁË£¬ÒÔ¼°ÐÞ¸ÄÁËÄÄЩÄÚÈÝ£¬ÕâÑù²Å»ªÊµÊ±·¢Ã÷ÎÊÌâ²¢¾ÙÐÐÐÞ¸´¡£±¾ÎĽ«»áÏÈÈÝͨ¹ýgitÉó²éÄÄЩÎļþ±»Ð޸ĵÄÒªÁì¡£
Ò»¡¢Éó²éÐ޻ڸĵÄÎļþ
ÎÒÃÇ¿ÉÒÔͨ¹ýgit statusÏÂÁîÉó²éÐ޻ڸĵÄÎļþ¡£ÔËÐиÃÏÂÁîºó£¬Git»áÁгöÄÄЩÎļþ±»ÐÞ¸ÄÁË¡£ÈôÊÇÎļþ±»ÐÞ¸ÄÁ˵«»¹Ã»Óб»Ìá½»µÄ»°£¬»á·ºÆðÔÚ”Changes not staged for commit”ÕâÒ»À¸ÖС£ÈôÊÇÒѾ±»Ìá½»ÁË£¬»á·ºÆðÔÚ”Changes to be committed”ÖС£
ÏêϸʹÓÃÒªÁìÈçÏ£º
$ git status
µÇ¼ºó¸´ÖÆ
¶þ¡¢Éó²éÎļþµÄÐÞ¸ÄÏêÇé
ÒªÉó²éÎļþµÄÐÞ¸ÄÏêÇ飬ÎÒÃÇ¿ÉÒÔʹÓÃgit diffÏÂÁî¡£¸ÃÏÂÁî¿ÉÒÔÁгöÁ½¸ö°æ±¾Ö®¼äµÄ²î±ð£¬°üÀ¨Ð޸ġ¢Ìí¼Ó¡¢É¾³ýµÈ²Ù×÷¡£ÎÒÃÇ¿ÉÒÔÖ¸¶¨ÎļþÃû»òÕßÎļþ¼ÐÃû³ÆÀ´Éó²éÏìÓ¦µÄ²î±ð¡£ÈôÊÇûÓÐÖ¸¶¨ÎļþÃû»òÕßÎļþ¼ÐÃû³Æ£¬ÔòĬÈÏÉó²éËùÓÐÐ޻ڸĵÄÎļþµÄ²î±ð¡£
ÏêϸʹÓÃÒªÁìÈçÏ£º
# Éó²éij¸öÎļþµÄÐÞ¸ÄÏêÇé $ git diff filename # Éó²éij¸öĿ¼ÏÂËùÓÐÎļþµÄÐÞ¸ÄÏêÇé $ git diff directoryname/ # Éó²éÖ¸¶¨°æ±¾Ö®¼äµÄ²î±ð£¬ÀýÈçÉó²éÉÏÒ»´ÎÌá½»ºÍÄ¿½ñÊÂÇéÇøÖ®¼äµÄ²î±ð $ git diff HEAD
µÇ¼ºó¸´ÖÆ
Èý¡¢Éó²éÎļþÐÞ¸ÄÀúÊ·
ÎÒÃÇ¿ÉÒÔʹÓÃgit logÏÂÁîÀ´Éó²éGit¿ÍÕ»ÖÐij¸öÎļþµÄÀúÊ·°æ±¾£¬°üÀ¨ÄÄЩ°æ±¾ÐÞ¸ÄÁËÕâ¸öÎļþ£¬ÒÔ¼°Ã¿´ÎÐ޸ĵÄÏêϸÄÚÈÝ¡£
ÏêϸʹÓÃÒªÁìÈçÏ£º
# Éó²éij¸öÎļþµÄÐÞ¸ÄÀúÊ· $ git log --follow filename
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉÏÊöÏÂÁî¿ÉÒÔÉó²éij¸öÎļþµÄËùÓÐÐÞ¸ÄÀúÊ·£¬°üÀ¨ËÐÞ¸ÄÁ˸ÃÎļþ¡¢ÐÞ¸Äʱ¼ä¡¢Ìá½»ÐÅÏ¢¡¢ÐÞ¸ÄÇ°ºóÎļþÄÚÈݵIJî±ðµÈÐÅÏ¢¡£
×ܽá
ÒÔÉÏÏÈÈÝÁËͨ¹ýGitÉó²éÄÄЩÎļþ±»Ð޸ĵÄÒªÁ죬°üÀ¨Ê¹ÓÃgit statusÉó²éÐ޸ĵÄÎļþÁÐ±í¡¢Ê¹ÓÃgit diffÉó²éÎļþµÄÐÞ¸ÄÏêÇ飬ÒÔ¼°Ê¹ÓÃgit logÉó²éÎļþµÄÐÞ¸ÄÀúÊ·µÈ¡£Í¨¹ýÕâЩÏÂÁîÎÒÃÇ¿ÉÒÔʵʱ·¢Ã÷ÎļþµÄת±ä£¬¸ú×ÙÎļþµÄÐÞ¸ÄÀúÊ·£¬°ü¹Ü´úÂëµÄ¿É¿¿ÐÔºÍÎȹÌÐÔ¡£
ÒÔÉϾÍÊÇgitÔõôÉó²éÄÄЩÎļþ±»Ð޸ĵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡