Git ÖÐÔõÑù¾ÙÐи´ÖƺÍÕ³Ìù
ÔÚʹÓà git ¾ÙÐпª·¢Ê±£¬³£³£»áÐèÒª¸´ÖÆ¡¢Õ³ÌùһЩ´úÂëƬ¶Ï»òÏÂÁî¡£¿ÉÊÇ£¬ÈôÊÇÄãÔÚÖÕ¶ËÖÐÖ±½ÓʹÓà ctrl+c¡¢ctrl+v µÈ×éºÏ¼ü¾ÙÐи´ÖƺÍÕ³Ìù£¬ºÜ¿ÉÄÜ»áÓöµ½Ò»Ð©ÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝ git ÖÐÔõÑù¾ÙÐи´ÖƺÍÕ³Ìù¡£
¸´ÖÆ
ÔÚ Git Ö´ÐÐÏÂÁîʱ£¬ÈôÊÇÐèÒª¸´ÖÆһЩ´úÂëƬ¶Ï»òÆäËûÐÅÏ¢£¬ÓÐÒÔϼ¸ÖÖ·½·¨£º
1.1 ʹÓÃÊó±êÑ¡ÔñÎı¾ºó¸´ÖÆ
ÕâÊÇ×î³£¼ûµÄ¸´ÖÆ·½·¨¡£ÔÚÖÕ¶ËÖÐʹÓÃÊó±êÑ¡ÔñÐèÒª¸´ÖƵÄÎı¾£¬È»ºóÖ±½ÓʹÓÃÊó±êÓÒ¼ü²Ëµ¥ÖÐµÄ “¸´ÖÆ” ¼´¿É½«Ñ¡ÔñµÄÎı¾¸´ÖƵ½¼ôÌù°åÖС£
1.2 ʹÓà Git ÄÚÖõĸ´ÖÆÏÂÁî
Git ÄÚÖÃÁËÒ»¸öÏÂÁî git clip£¬¿ÉÒÔ½«Ö¸¶¨ÎļþµÄÄÚÈݸ´ÖƵ½¼ôÌù°åÖУ¬Ê¹ÓÃÒªÁìÈçÏ£º
git clip <file></file>
µÇ¼ºó¸´ÖÆ
ÆäÖÐ ÌåÏÖÐèÒª¸´ÖƵÄÎļþÃû¡£
ÀýÈ磬Ҫ¸´ÖÆÄ¿½ñ Git ¿ÍÕ»ÖÐµÄ README.md Îļþ£¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
git clip README.md
µÇ¼ºó¸´ÖÆ
1.3 ʹÓùܵÀ·û½«ÏÂÁîÊä³ö¸´ÖƵ½¼ôÌù°åÖÐ
ÔÚÖÕ¶ËÖУ¬¿ÉÒÔʹÓùܵÀ·û½«Ò»¸öÏÂÁîµÄÊä³ö×÷ΪÁíÒ»¸öÏÂÁîµÄÊäÈë¡£ÀýÈ磬Ҫ½« Git ¿ÍÕ»ÖеÄij¸öÎļþµÄÄÚÈݸ´ÖƵ½¼ôÌù°åÖУ¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁ
cat README.md | pbcopy
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬cat README.md ÊÇÊä³öÎļþÄÚÈݵÄÏÂÁ| ÊǹܵÀ·û£¬pbcopy Êǽ«ÊäÈ븴ÖƵ½¼ôÌù°åµÄÏÂÁî¡£Õâ¸öÏÂÁî¿ÉÒÔÔÚ macOS ϵͳÖÐʹÓã¬ÈôÊÇÊÇÆäËüϵͳ£¬ÐèҪʹÓÃÏìÓ¦µÄÏÂÁîÌæ»» pbcopy¡£
Õ³Ìù
ÔÚ Git ÖУ¬Ö±½ÓʹÓà Ctrl+V Õ³Ìù¿ÉÄܻᵼÖÂһЩÎÊÌ⣬ÌØÊâÊÇÔÚ Windows ϵͳÏ¡£ÕâÊÇÓÉÓÚÔÚ Git µÄÖÕ¶ËÖУ¬Ctrl+V ±»ÒÔΪÊÇÒ»¸öÌØÊâ×Ö·û£¬ÓÃÀ´ÌåÏÖÏÂÒ»¸ö×Ö·ûÊÇ×ÖÃæÉϵÄ×Ö·û£¬¶ø²»ÊÇÒ»¸ö¿ØÖÆ×Ö·û¡£
Òò´Ë£¬ÔÚ Git ÖУ¬ÈôÊÇÐèÒªÕ³ÌùһЩÎı¾£¬¿ÉÒÔʹÓÃÒÔϼ¸ÖÖ·½·¨£º
2.1 ʹÓÃÊó±êÓÒ¼ü²Ëµ¥ÖÐµÄ “Õ³Ìù” ²Ëµ¥
ÕâÊÇ×î¼òÆÓµÄÕ³Ìù·½·¨¡£½«ÐèÒªÕ³ÌùµÄÎı¾¸´ÖƵ½¼ôÌù°åÖУ¬ÔÚÖÕ¶ËÖÐʹÓÃÊó±êÓÒ¼ü²Ëµ¥ÖÐµÄ “Õ³Ìù” ¼´¿É½«Îı¾Õ³Ìùµ½ÖÕ¶ËÖС£
2.2 ʹÓà Shift+Insert ¾ÙÐÐÕ³Ìù
ÔÚijЩÖÕ¶ËÖУ¬¿ÉÒÔʹÓà Shift+Insert ×éºÏ¼ü¾ÙÐÐÕ³Ìù¡£½«ÐèÒªÕ³ÌùµÄÎı¾¸´ÖƵ½¼ôÌù°åÖУ¬ÔÚÖÕ¶ËÖÐʹÓà Shift+Insert ¾ÙÐÐÕ³Ìù¡£
2.3 ʹÓà Git ÄÚÖõÄÕ³ÌùÏÂÁî
Git ÄÚÖÃÁËÒ»¸öÏÂÁî git paste£¬¿ÉÒÔ½«¼ôÌù°åÖеÄÎı¾Õ³Ìùµ½ÖÕ¶ËÖУ¬Ê¹ÓÃÒªÁìÈçÏ£º
git paste
µÇ¼ºó¸´ÖÆ
ÔÚÖ´ÐÐÕâ¸öÏÂÁîÇ°£¬ÐèÒª½«ÐèÒªÕ³ÌùµÄÎı¾¸´ÖƵ½¼ôÌù°åÖС£
×ÛÉÏËùÊö£¬ËäÈ» Git Öеĸ´ÖƺÍÕ³Ìù¿ÉÄÜ»áÓÐЩÎÊÌ⣬¿ÉÊÇͨ¹ýʹÓÃÊʵ±µÄÒªÁ죬¿ÉÒÔÇáËɵؽâ¾öÕâЩÎÊÌ⣬Ìá¸ßÊÂÇéЧÂÊ¡£
ÒÔÉϾÍÊÇGit ÖÐÔõÑù¾ÙÐи´ÖƺÍÕ³ÌùµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡