gitÔõôÌí¼Ó½»»¥Ê½Êý×ÖÐźÅ
git ÊÇÒ»¸ö¿ªÔ´µÄ°æ±¾¿ØÖÆϵͳ£¬¿ÉÒÔ×ÊÖúÓû§ÖÎÀíÏîÄ¿ÖеĴúÂë¡¢ÎĵµµÈÎļþ¡£ÔÚ git ÖУ¬ÎªÁËÀû±ãÓû§¶Ô²î±ð°æ±¾µÄ´úÂë¾ÙÐÐÖÎÀí£¬¿ÉÒÔʹÓñêÇ©£¨tag£©¡¢·ÖÖ§£¨branch£©µÈ¹¦Ð§¡£ÆäÖУ¬±êÇ©ÊÇ git Öг£ÓõÄÒ»¸ö¹¦Ð§£¬¿ÉÒÔ×ÊÖúÓû§ÔÚ´úÂëÖÐÌí¼ÓһЩÌØÊâµÄ±ê¼Ç£¬±ãÓÚÖÎÀíºÍÉó²é¡£
ÔÚʹÓà Git ÖУ¬ÓÐÒ»ÖÖ³£¼ûµÄ³¡¾°ÊÇÐèÒªÔÚ´úÂëÖÐÌí¼ÓһЩ½»»¥Ê½Êý×ÖÐźš£ÕâÖÖÐźſÉÒÔÓÃÀ´¿ØÖƳÌÐòµÄÔËÐУ¬ºÃ±È¿ÉÒÔÓÃÀ´¾ÙÐе÷ÊÔ£¬Éó²é³ÌÐòµÄÔËÐÐ״̬µÈ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ Git ÖÐÌí¼Ó½»»¥Ê½Êý×ÖÐźš£
ÔÚ´úÂëÖÐÌí¼Ó½»»¥Ê½Êý×ÖÐźÅ
ÔÚ Git ÖÐÌí¼Ó½»»¥Ê½Êý×ÖÐźţ¬ÐèÒªÏÈÔÚ´úÂëÖÐÌí¼ÓÏìÓ¦µÄ´úÂë¡£ÏêϸµÄ²Ù×÷ÒªÁìÈçÏ£º
£¨1£© ÔÚ´úÂëÖÐÌí¼Ó½»»¥Ê½Êý×ÖÐźŵĴúÂ룬ºÃ±ÈÎÒÃÇ¿ÉÒÔÌí¼ÓÒ»¸ö±äÁ¿ num£¬À´ÌåÏÖÓû§ÊäÈëµÄÊý×ÖÐźţº
int num; scanf("%d", &num);
µÇ¼ºó¸´ÖÆ
£¨2£© Ìí¼Ó´úÂëµÄÀú³Ì£¬¿ÉÒÔʹÓÃÎı¾±à¼Æ÷»òÕß¼¯³É¿ª·¢ÇéÐΣ¨IDE£©À´Íê³É¡£ÔÚ±à¼Æ÷ÖУ¬ÎÒÃÇ¿ÉÒÔ½«´úÂëÊäÈëµ½ÏìÓ¦µÄÎļþÖУ¬È»ºóÉúÑļ´¿É¡£
£¨3£© ½«´úÂëÉúÑĺ󣬿ÉÒÔʹÓà Git ÏÂÁ´úÂëÌá½»µ½´úÂë¿ÍÕ»ÖС£ÏêϸµÄÏÂÁîΪ£º
git add <filename> git commit -m "add interactive signal code"</filename>
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬ ÌåÏÖÒªÌá½»µÄÎļþÃû£¬-m ºóÃæµÄ×Ö·û´®ÌåÏÖÌá½»µÄ×¢ÊÍÐÅÏ¢¡£
ÔÚ½»»¥Ê½Êý×ÖÐźÅÉÏÌí¼Ó±êÇ©
ÔÚ½«´úÂëÌá½»µ½´úÂë¿ÍÕ»Öкó£¬ÎÒÃÇ¿ÉÒÔÔÚ½»»¥Ê½Êý×ÖÐźÅÉÏÌí¼Ó±êÇ©£¬Àû±ãÔÚºóÐøµÄÖÎÀíºÍÉó²éÖÐʹÓá£ÏêϸµÄ²Ù×÷ÒªÁìÈçÏ£º
£¨1£© ÔÚ´úÂë¿ÍÕ»ÖУ¬½øÈëµ½ÏêϸµÄÌá½»¼Í¼ÖС£¿ÉÒÔʹÓà Git ÏÂÁî git log Éó²éÌá½»¼Í¼µÄÀúÊ·ÐÅÏ¢¡£ºÃ±È¿ÉÒÔÊäÈëÒÔÏÂÏÂÁ
git log
µÇ¼ºó¸´ÖÆ
£¨2£© ÕÒµ½ÒªÌí¼Ó±êÇ©µÄ½»»¥Ê½Êý×ÖÐźÅËùÔÚµÄÌá½»¼Í¼¡£¿ÉÒÔʹÓÃÏÂÁî git show À´Éó²éÖ¸¶¨Ìá½»¼Í¼µÄÏêϸÐÅÏ¢¡£ºÃ±È¿ÉÒÔÊäÈëÒÔÏÂÏÂÁ
git show <commit-id></commit-id>
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬ ÌåÏÖÒªÉó²éµÄÌá½»¼Í¼µÄ ID¡£
£¨3£© ÔÚÉó²éµ½½»»¥Ê½Êý×ÖÐźÅËùÔÚµÄÌá½»¼Í¼ºó£¬¿ÉÒÔʹÓà Git ÏÂÁî git tag Ìí¼Ó±êÇ©¡£ºÃ±È¿ÉÒÔÊäÈëÒÔÏÂÏÂÁ
git tag -a v1.0 -m "add interactive signal code"
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬-a ÌåÏÖÒªÌí¼Ó±êÇ©£¬v1.0 ÌåÏÖ±êÇ©µÄÃû³Æ£¬-m ºóÃæµÄ×Ö·û´®ÌåÏÖ±êÇ©µÄ×¢ÊÍÐÅÏ¢¡£
Éó²éºÍÖÎÀí±êÇ©
ÔÚÌí¼ÓÁ˱êÇ©Ö®ºó£¬ÎÒÃÇ¿ÉÒÔʹÓà Git ÌṩµÄһЩÏÂÁîÀ´Éó²éºÍÖÎÀí±êÇ©¡£ºÃ±È¿ÉÒÔʹÓÃÏÂÁî git tag Éó²éËùÓеıêÇ©£º
git tag
µÇ¼ºó¸´ÖÆ
ÈôÊÇÐèÒªÉó²éij¸öÌض¨µÄ±êÇ©µÄÏêϸÐÅÏ¢£¬¿ÉÒÔʹÓÃÏÂÁî git show £º
git show v1.0
µÇ¼ºó¸´ÖÆ
ÈôÊÇÐèҪɾ³ý±êÇ©£¬¿ÉÒÔʹÓÃÏÂÁî git tag -d £º
git tag -d v1.0
µÇ¼ºó¸´ÖÆ
ÈôÊÇÐèÒª½«±êÇ©ÍÆË͵½Ô¶³Ì¿ÍÕ»ÖУ¬¿ÉÒÔʹÓÃÏÂÁî git push £º
git push origin v1.0
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬ ÌåÏÖÔ¶³Ì¿ÍÕ»µÄÃû³Æ£¬¿ÉÒÔʹÓÃÏÂÁî git remote Éó²é¡£ÔÚĬÈÏÇéÐÎÏ£¬Ô¶³Ì¿ÍÕ»µÄÃû³ÆΪ origin¡£
×ÜÖ®£¬Í¨¹ýÔÚ´úÂëÖÐÌí¼Ó½»»¥Ê½Êý×ÖÐźţ¬È»ºóÔÚ½»»¥Ê½Êý×ÖÐźÅÉÏÌí¼Ó±êÇ©µÄ·½·¨£¬¿ÉÒÔÀû±ãµØÖÎÀíºÍÉó²é Git ÏîÄ¿ÖеĴúÂë¡£
ÒÔÉϾÍÊÇgitÔõôÌí¼Ó½»»¥Ê½Êý×ÖÐźŵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡