ÔõÑùÔÚ Mac ÉÏ×°Öò¢ÉèÖà Git Flow
git flow ÊÇÒ»ÖÖºÜÊÇÊ¢ÐÐµÄ git ²Ù×÷·½·¨£¬Ëüͨ¹ý½ç˵һЩÊÂÇéÁ÷³ÌºÍ·ÖÖ§ÖÎÀí¹æÔò£¬À´ÓÅ»¯´úÂë¿ÍÕ»µÄÖÎÀíºÍÍŶÓÐ×÷£¬ïÔ̹ýʧºÍ³åÍ»£¬Ìá¸ßЧÂʺʹúÂëÖÊÁ¿¡£
ËäÈ» Git Flow ¿´ÆðÀ´½ÏÁ¿Öش󣬵«ÏÖʵÉÏËüÊÇ»ùÓÚ Git µÄ·ÖÖ§²Ù×÷ºÍºÏ²¢»úÖÆÖ®ÉϵÄÒ»¸öÒ×ÓÚÃ÷È·ºÍʹÓõŤ¾ß¼¯£¬²¢ÇÒÔÚ¿ª·¢ÍŶÓÖÐÒѱ»ÆÕ±éÓ¦Óá£
ÈôÊÇÄãʹÓõÄÊÇ Mac ²Ù×÷ϵͳ£¬ÄÇôÏÂÃ潫ÏÈÈÝÔõÑùÔÚ Mac ÉÏ×°Öò¢ÉèÖà Git Flow¡£
×¼±¸ÊÂÇé
ÔÚ×îÏÈ×°Öà Git Flow ֮ǰ£¬ÄãÐèÒª¾ÙÐÐһЩ׼±¸ÊÂÇé¡£
Ê×ÏÈ£¬ÄãÐèҪȷ±£ÔÚ Mac ÉÏÒѾװÖÃÁË Git ºÍ Homebrew¡£ÈôÊÇûÓÐ×°Ö㬿ÉÒÔͨ¹ýÒÔÏÂÁ½¸öÏÂÁîÐÐÀ´×°Öãº
/usr/bin/ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”
ºÍ
brew install git
Æä´Î£¬ÐèҪʹÓà Terminal ÖÕ¶ËÀ´Ö´ÐÐÏÂÃæµÄÏÂÁÒò´ËÄãÐèҪȷ¶¨ÒÑ·¿ª Terminal Öնˣ¬²¢ÔÚÖÕ¶ËÖÐʹÓÃÒÔÏÂÏÂÁîÀ´ÑéÖ¤ Git ºÍ Homebrew ÊÇ·ñÒÑ×°Öãº
git –version
brew –version
ÈôÊÇÄÜÏÔʾ°æ±¾ºÅ£¬Ôò˵Ã÷ÒѾװÖÃÀֳɡ£
×°ÖÃ Git Flow
Git Flow µÄ×°ÖÿÉÒÔͨ¹ý Homebrew À´¿ìËÙÍê³É¡£
ÔÚ Terminal ÖÕ¶ËÖÐÖ´ÐÐÒÔÏÂÏÂÁî¼´¿É£º
brew install git-flow
ÕâÀïµÄ git-flow ÊÇÒ»¸ö°üÀ¨ Git Flow ËùÓй¦Ð§µÄ Bash ¾ç±¾£¬Ëü»áÔÚ /usr/local/bin Ŀ¼Ï½¨ÉèÒ»¸ö git-flow ÏÂÁî¡£
ÉèÖÃ Git Flow
×°Öà Git Flow ºó£¬ÐèÒª¶ÔËü¾ÙÐлù±¾ÉèÖã¬ÒÔ±ãÓë×ðÁú¿Ê± Git ¿ÍÕ»ÅäºÏʹÓá£
ÔÚÖÕ¶ËÖÐÊäÈëÒÔÏÂÏÂÁî¾ÙÐÐÉèÖãº
git flow init
Õ⽫ÔÚÄãµÄ Git ¿ÍÕ»Öн¨ÉèÁ½¸öÖ÷ÒªµÄ·ÖÖ§£ºdevelop£¨¿ª·¢·ÖÖ§£©ºÍ master£¨Îȹ̷ÖÖ§£©¡£
Ö®ºó£¬Äã¿ÉÒÔƾ֤ Git Flow µÄ²Ù×÷¹æÔòÀ´½¨ÉèºÍÖÎÀíÆäËû·ÖÖ§£¬ºÃ±È feature¡¢release¡¢hotfix ºÍ support ·ÖÖ§¡£
ÁíÍ⣬Ä㻹¿ÉÒÔÔÚ ~/.gitconfig ÉèÖÃÎļþÖмÓÈëÈçÏÂÉèÖòÎÊý£º
[gitflow “prefix”]
feature = feature/ release = release/ hotfix = hotfix/ support = support/ versiontag =
µÇ¼ºó¸´ÖÆ
ÕâÀïÉèÖÃÁ˲î±ð·ÖÖ§µÄǰ׺ºÍ°æ±¾ºÅ±ê¼Ç£¬ÒÔÀû±ã²Ù×÷ºÍ°æ±¾¿ØÖÆ¡£
ʹÓà Git Flow
×°ÖúÍÉèÖÃÍê±Ïºó£¬¾Í¿ÉÒÔ×îÏÈʹÓà Git Flow ÁË¡£
ÀýÈ磬ÈôÊÇÒª½¨ÉèÒ»¸öÐµĹ¦Ð§·ÖÖ§£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
git flow feature start
Õ⽫ÔÚÍâµØºÍÔ¶³Ì¿ÍÕ»Öн¨ÉèÒ»¸öÐ嵀 feature ·ÖÖ§£¬²¢½«Æä´Ó develop ·ÖÖ§ÖÐÊèÉ¢³öÀ´£¬¿ÉÒÔÔÚÕâ¸ö·ÖÖ§ÉϾÙÐпª·¢ºÍµ÷ÊÔ¡£
µ±¹¦Ð§·ÖÖ§Íê³Éºó£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁÆäºÏ²¢»Ø develop ·ÖÖ§£º
git flow feature finish
Õ⽫»á½« feature ·ÖÖ§µÄËùÓиü¸ÄºÏ²¢µ½ develop ·ÖÖ§ÉÏ£¬²¢½«·Ö֧ɾ³ý¡£
ÁíÍ⣬Ä㻹¿ÉÒÔͨ¹ýһЩ²ÎÊýºÍÑ¡ÏîÀ´µ÷½â Git Flow µÄ²Ù×÷·½·¨ºÍÕ½ÂÔ£¬ÏêϸÐÅÏ¢¿ÉÒÔÉó²é Git Flow µÄ¹Ù·½Îĵµ¡£
×ܽá
ͨ¹ýÉÏÊö°ì·¨£¬Äã¿ÉÒÔÔÚ Mac ÉÏÀÖ³É×°Öò¢ÉèÖà Git Flow£¬Õ⽫ÓÐÓõØÌá¸ß´úÂëÖÎÀíºÍÍŶÓÐ×÷µÄЧÂʺÍÖÊÁ¿¡£
ËäÈ»£¬Git Flow Ö»ÊÇÒ»ÖÖ¹¤¾ßºÍÒªÁ죬ÔõÑùʹÓúÍÔËÓÃËü£¬»¹ÐèҪƾ֤ÍŶӵÄÏêϸÇéÐκÍÐèÇóÀ´¾ÙÐе÷½âºÍÔö²¹¡£
ÒÔÉϾÍÊÇÔõÑùÔÚ Mac ÉÏ×°Öò¢ÉèÖà Git FlowµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡