×ܽáÆÊÎöGit pull ³£¼ûµÄ¹ýʧ¼°Æä½â¾öÒªÁì
ÔÚʹÓà git ¾ÙÐÐÏîÄ¿Ð×÷ʱ£¬ÎÒÃǾ³£»áʹÓà git pull ÏÂÁîÀ´Í¬²½Ô¶³Ì¿ÍÕ»ÖеĴúÂëµ½ÍâµØ¡£Ö»¹ÜÕâ¸öÏÂÁîºÜÊǼòÆÓÒ×Ó㬵«ÓÐʱ¼ä¿ÉÄÜ»áÓöµ½ÖÖÖÖ¸÷ÑùµÄ¹ýʧ£¬ÉõÖÁµ¼ÖÂÏîÄ¿ÎÞ·¨Õý³£ÔËÐС£±¾ÎĽ«ÆÊÎö git pull ³£¼ûµÄ¹ýʧ¼°Æä½â¾öÒªÁì¡£
Ò»¡¢¹ýʧÐÅÏ¢
error: Your local changes to ‘file-name’ would be overwritten by merge
ÕâÊÇÓÉÓÚÓÐÍâµØ´úÂëûÓÐÌá½»£¬»áµ¼Ö Git pull ºÏ²¢´úÂëʱ·ºÆð³åÍ»¡£½â¾öÒªÁìÊÇÏȽ«ÍâµØÐÞ¸ÄÌá½»£¬»òÕßʹÓà git stash ÏÂÁÐ޸Ļº´æÆðÀ´£¬ÔÙʹÓà git pull £¬×îºóºÏ²¢´úÂë¡£
error: The following untracked working tree files would be overwritten by merge
Õâ¸ö¹ýʧÊÇÓÉÓÚÄãÔÚÍâµØ½¨ÉèÁËÐÂÎļþ»òÐÞ¸ÄÎļþ£¬ÕâЩÎļþûÓб» Git ¸ú×Ù£¬Ò²Ã»ÓоÙÐÐ git add ²Ù×÷¡£½â¾öÒªÁìÊÇÓà git stash ÏÂÁÕâЩÐ޸Ļº´æ£¬ÔÚʹÓà git pull ºóÔÙʹÓà git stash pop ÏÂÁî»Ö¸´Ð޸ġ£
error: Your local changes to ‘file-name’ would be lost
Õâ¸ö¹ýʧÊÇÓÉÓÚÍâµØ´úÂë×öÁËÐ޸ģ¬µ«Ã»ÓÐÌá½»£¬ÒªÏÈÌá½»Ð޸ĺóÔÙ¾ÙÐÐ git pull¡£
error: cannot pull with rebase: You have unstaged changes
ÕâÖÖ¹ýʧÊÇ Git pull Óà rebase ģʽºÏ²¢´úÂëʱ·ºÆðµÄ¡£½â¾öÒªÁìÊÇʹÓà git stash ÏÂÁÐ޸Ļº´æºóÔÙʵÑé git pull ²Ù×÷¡£
error: cannot pull with rebase: You have uncommitted changes
Õâ¸ö¹ýʧµÄÔµ¹ÊÔÓÉºÍµÚ 4 ÖÖ¹ýʧһÑù£¬¶¼ÊÇÓÉÓÚ Git pull ÔÚʹÓà rebase ģʽºÏ²¢´úÂëʱ·ºÆðµÄ¡£½â¾öÒªÁìÒ²ÊÇʹÓà git stash ÏÂÁÐ޸Ļº´æºóÔÙʵÑé git pull ²Ù×÷¡£
error: could not detach HEAD
Õâ¸ö¹ýʧÊÇÓÉÓÚ Git pull ²Ù×÷ÖÐʹÓÃÁË –rebase »ò –merge ²ÎÊýµ¼Ö£¬ºÍÄ¿½ñ HEAD ´¦ÓÚ¡°Êèɢ״̬¡±Óйء£½â¾öÒªÁìÊǽ«ÍâµØ·ÖÖ§Çл»µ½Ò»¸ö׼ȷµÄ°æ±¾¡£
error: Failed to merge in the changes.
ÕâÊÇÓÉÓÚ Git pull ºóijЩÎļþÎÞ·¨ºÏ²¢Ôì³ÉµÄ¹ýʧ¡£½â¾öÒªÁìÊÇÊÖ¶¯½â¾ö³åÍ»£¬¼´ÐÞ¸ÄÎļþ£¬½â¾ö³åÍ»ºóÔÙ¾ÙÐÐ git add ºÍ git commit ²Ù×÷¡£
¶þ¡¢½â¾öÒªÁì
ÕûÀí»º´æ£ºÔÚʹÓà git pull ÏÂÁîÇ°£¬ÏÈÖ´ÐÐ git stash ÏÂÁÍâµØÐ޸Ļº´æÆðÀ´¡£ÓÃÍê git pull ºóÔÙÖ´ÐÐ git stash pop ÏÂÁî»Ö¸´Ð޸ġ£
Ìá½»ÍâµØÐ޸ģº½«ÍâµØÐ޸ĵÄÎļþÏÈÌá½»µ½ÍâµØ·ÖÖ§ÉÏ£¬ÔÙÖ´ÐÐ git pull ÏÂÁî¡£
Çл»·ÖÖ§£ºÈôÊÇ·ºÆðÁË HEAD ´¦ÓÚ¡°Êèɢ״̬¡±µÄ¹ýʧ£¬ÐèÒª½«ÍâµØ·ÖÖ§Çл»µ½×¼È·µÄ°æ±¾ÉÏ¡£
½â¾ö³åÍ»£ºÊÖ¶¯ÐÞ¸ÄÓгåÍ»µÄ´úÂ룬ÔÚ½â¾öÍê³åÍ»ºóÔÙ¾ÙÐÐ git add ºÍ git commit ²Ù×÷¡£
×ܽá
ÔÚ Git Ð×÷ÖУ¬Git pull ÏÂÁîÊDZز»¿ÉÉٵġ£¿ÉÊÇÎÒÃÇÒ²±ØÐèÊìϤµ½ Git pull Àú³ÌÖпÉÄÜÓöµ½µÄ¹ýʧ£¬ÒÔ±ãÎÒÃÇÄܹ»¸üÓÐÓõؽâ¾öÕâЩÎÊÌâ¡£×ܵÄÀ´Ëµ£¬Óöµ½¹ýʧ²»ÒªÊÖæ½ÅÂÒ£¬Ó¦¸Ãƾ֤¹ýʧԵ¹ÊÔÓɽÓÄÉÏìÓ¦µÄ²½·¥£¬ÒÔ±ã×ðÁú¿Ê±´úÂëºÏ²¢Ë³ËìÎÞ×è¡£
ÒÔÉϾÍÊÇ×ܽáÆÊÎöGit pull ³£¼ûµÄ¹ýʧ¼°Æä½â¾öÒªÁìµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡