m e g i t c o n f i g [ ‐ ‐ g l o b a l ] u s e r . n a m e < n a m e > # S e t t h e e m a i l g i t c o n f i g [ ‐ ‐ g l o b a l ] u s e r . e m a i l < e m a i l > g i t c o n f i g ‐ ‐ g l o b a l c o l o r . u i a u t o # S e t u p s t r e a m r e p o s i t o r y g i t r e m o t e a d d < u p s t r e a m > < G I T _ R E P O _ U R L > # L i s t a l l u p s t r e a m e n d p o i n t s g i t r e m o t e ‐ v analysys.cn 4
a s ] s t = s t a t u s ‐ ‐ p o r c e l a i n ‐ ‐ i g n o r e ‐ s u b m o d u l e s = d i r t y ‐ s c i = c o m m i t b r = b r a n c h c o = c h e c k o u t d f = d i f f ‐ b d t = d i f f t o o l l s = l s ‐ f i l e s a m e n d = c o m m i t ‐ ‐ a m e n d [ c o r e ] # d e a c t i v a t e L F w i l l b e r e p l a c e d b y C R L F a u t o c r l f = f a l s e [ b r a n c h ] a u t o s e t u p r e b a s e = a l w a y s 参考更多秘制配置 analysys.cn 5
对同一功能的重复提交请使用 ‐ ‐ a m e n d , 注意不要 amend 已经 推送过的 commits 删除、重命名,请使用 g i t m v , g i t r m # ‐ ‐ u p d a t e , A d d t r a c k e d f i l e s o n l y . g i t a d d ‐ u # ‐ ‐ a l l , A d d a l l o f t h e f i l e s : a d d s , m o d i f i e d s , a n d r e m o v e s . g i t a d d ‐ A # C h a n g e t h e l a s t c o m m i t , p r e v e n t d u p l i c a t f e a t u r e d c o m m i t s . g i t c o m m i t ‐ ‐ a m e n d # C o m m i t a l l t r a c k e d c h a n g e s = > g i t a d d ‐ u & & g i t c o m m i t ‐ m " x x x " g i t c o m m i t ‐ a m " < C O M M I T _ M S G > " # c a c h e s t a s h g i t s t a s h [ c l e a r | p o p ] analysys.cn 6
g e s o v e r t i m e f o r a s p e c i f i c f i l e g i t l o g ‐ p < f i l e > # ‐ ‐ s t a t # S h o w c h a n g e s o v e r t i m e f o r a s p e c i f i c c o m m i t t e r g i t l o g ‐ ‐ a u t h o r = < c o m m i t t e r n a m e > # N o t e : < c o m m i t t e r n a m e > i s a p a t t e r n . # S e a r c h ( g r e p ) c o m m i t m e s s a g e s f o r t h e g i v e n s t r i n g g i t l o g ‐ ‐ g r e p = < s t r i n g > # l o c a l c o m m a n d a r c h i v e . g i t r e f l o g # R e v i e w s p e c i f i c c o m m i t f i l e l i s t g i t s h o w < C O M M I T > ‐ ‐ n a m e ‐ o n l y g i t s h o w < C O M M I T > ‐ ‐ s t a t # R e v i e w s p e c i f i c c o m m i t f i l e c o n t e n t s g i t s h o w < C O M M I T > : < F I L E _ P A T H > analysys.cn 7
a n e w b r a n c h c a l l e d " d e v " u n d e r t h e " m a s t e r " g i t c o ‐ b d e v m a s t e r # r e n a m e g i t c o ‐ m < o l d > < n e w > # d e l e t e l o c a l l y g i t c o ‐ D < b r a n c h _ n a m e > # d e l e t e r e m o t e l y g i t p u s h < u p s t r e a m > : < b r a n c h _ n a m e > # c r e a t e t a g g i t t a g ‐ a < t a g > [ c o m m i t ] ‐ m " < r e l e a s e n o t e > " # d e l e t e t a g g i t t a g ‐ d < t a g > analysys.cn 8
e g i t b r ‐ ‐ m e r g e d g i t c h e r r y g i t c h e r r y ‐ p i c k g i t r e b a s e [ ‐ ‐ c o n t i n u e , ‐ ‐ a b o r t ] g i t c h e c k o u t [ ‐ 2 , ‐ 3 ] analysys.cn 10
d . g i t c o m m i t ‐ a # 删除、重置慎用 g i t r m g i t r e s e t ‐ ‐ h a r d # 远程覆盖别人提交记录 g i t p u s h ‐ f # 远程远程分支 g i t p u s h < u p s t r e a m > : < b r a n c h _ n a m e > analysys.cn 12
j o b 定义 d e v e l o p m e n t : t a g s : # 环境区分:d e v e l o p m e n t , p r o d u c t i o n ‐ d e v e l o p m e n t s c r i p t : ‐ m v n c l e a n p a c k a g e ‐ P d e v ‐ D s k i p T e s t s = t r u e ‐ g i t d e p l o y ‐ ‐ n o ‐ c a c h e ‐ f $ { C I _ P R O J E C T _ D I R } / t a r g e t / f a n g z h o u ‐ a s ‐ a o n l y : ‐ d e v ‐ t r i g g e r s # . . . analysys.cn 14