{"id":19560,"date":"2024-11-19T09:10:11","date_gmt":"2024-11-19T01:10:11","guid":{"rendered":"https:\/\/fwq.ai\/blog\/19560\/"},"modified":"2024-11-19T09:10:11","modified_gmt":"2024-11-19T01:10:11","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8mac%e4%b8%8a%e8%ae%be%e7%bd%ae-git","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/19560\/","title":{"rendered":"\u5982\u4f55\u5728Mac\u4e0a\u8bbe\u7f6e Git"},"content":{"rendered":"<p>mac\u7cfb\u7edf\u662f\u5f00\u53d1\u8005\u4e2d\u975e\u5e38\u6d41\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u800c git \u662f\u5927\u5bb6\u6700\u4e3a\u719f\u77e5\u7684\u4ee3\u7801\u7248\u672c\u63a7\u5236\u5de5\u5177\u3002\u4f7f\u7528 git \u6709\u5f88\u591a\u597d\u5904\uff0c\u6bd4\u5982\u65b9\u4fbf\u591a\u4eba\u534f\u540c\u5f00\u53d1\u3001\u7248\u672c\u63a7\u5236\u3001\u5907\u4efd\u7b49\u7b49\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728 mac \u4e0a\u8bbe\u7f6e git\u3002<\/p>\n<p>\u4e00\u3001\u5b89\u88c5 Git<\/p>\n<p>Mac \u7cfb\u7edf\u9ed8\u8ba4\u662f\u6ca1\u6709\u5b89\u88c5 Git \u7684\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u624b\u52a8\u5b89\u88c5\u3002\u6709\u4e24\u79cd\u65b9\u6cd5\u5b89\u88c5 Git \uff1a<\/p>\n<ol>\n<li>\u901a\u8fc7 Homebrew \u5b89\u88c5<\/li>\n<\/ol>\n<p>Homebrew \u662f Mac OS X \u4e0b\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u540c\u6837\u9700\u8981\u5b89\u88c5\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>\/usr\/bin\/ruby -e \"$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u63a5\u7740\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 Git \uff1a<\/p>\n<pre>brew install git<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u4e0b\u8f7d Git \u5b89\u88c5\u5305<\/li>\n<\/ol>\n<p>\u4ece\u5b98\u7f51 [https:\/\/git-scm.com\/downloads](https:\/\/git-scm.com\/downloads) \u4e0b\u8f7d Git \u5b89\u88c5\u5305\uff0c\u7136\u540e\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u5373\u53ef\u3002<\/p>\n<p>\u4e8c\u3001\u914d\u7f6e Git<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6e Git\u3002\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u914d\u7f6e\uff1a<\/p>\n<ol>\n<li>\u914d\u7f6e\u7528\u6237\u4fe1\u606f<\/li>\n<\/ol>\n<pre>git config --global user.name \"Your Name\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236    <\/p>\n<pre>git config --global user.email \"you@example.com\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<ol>\n<li>\u914d\u7f6e\u6587\u672c\u7f16\u8f91\u5668<\/li>\n<\/ol>\n<pre>git config --global core.editor \"vim\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u4e0a\u9762\u7684\u547d\u4ee4\u4f1a\u5c06 Git \u9ed8\u8ba4\u4f7f\u7528\u7684\u7f16\u8f91\u5668\u8bbe\u4e3a Vim\u3002<\/p>\n<ol>\n<li>\u914d\u7f6e\u5176\u4ed6\u9009\u9879<\/li>\n<\/ol>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u914d\u7f6e\uff1a<\/p>\n<pre>git config --global color.ui true<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u8fd9\u6837 Git \u547d\u4ee4\u8f93\u51fa\u7684\u4fe1\u606f\u4f1a\u5e26\u6709\u989c\u8272\uff0c\u8bb8\u591a\u4eba\u4f1a\u89c9\u5f97\u8fd9\u6837\u66f4\u52a0\u65b9\u4fbf\u533a\u5206\u3002<\/p>\n<p>\u4e09\u3001\u4f7f\u7528 Git<\/p>\n<p>\u5b89\u88c5\u548c\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528 Git \u8fdb\u884c\u4ee3\u7801\u7ba1\u7406\u4e86\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528 Git \u547d\u4ee4\uff1a<\/p>\n<ol>\n<li>\u521b\u5efa\u672c\u5730\u4ee3\u7801\u5e93<\/li>\n<\/ol>\n<pre>git init<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5728\u6587\u4ef6\u5939\u91cc\u8fd0\u884c\u8fd9\u4e2a\u547d\u4ee4\uff0c\u5c31\u53ef\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684 Git \u4ee3\u7801\u5e93\u3002<\/p>\n<ol>\n<li>\u6dfb\u52a0\u6587\u4ef6\u5230\u4ee3\u7801\u5e93<\/li>\n<\/ol>\n<pre>git add filename<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u5c06\u6307\u5b9a\u6587\u4ef6\u6dfb\u52a0\u5230 Git \u4ee3\u7801\u5e93\u4e2d\u3002<\/p>\n<ol>\n<li>\u63d0\u4ea4\u4ee3\u7801<\/li>\n<\/ol>\n<pre>git commit -m \"commit message\"<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u63d0\u4ea4\u4ee3\u7801\uff0c\u5e76\u9644\u4e0a\u4e00\u4e2a\u63d0\u4ea4\u4fe1\u606f\u3002<\/p>\n<ol>\n<li>\u67e5\u770b\u4ee3\u7801\u5e93\u72b6\u6001<\/li>\n<\/ol>\n<pre>git status<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u67e5\u770b\u4ee3\u7801\u5e93\u5f53\u524d\u72b6\u6001\uff0c\u5305\u62ec\u5df2\u4fee\u6539\u4f46\u672a\u63d0\u4ea4\u3001\u5df2\u63d0\u4ea4\u4f46\u672a\u63a8\u9001\u7b49\u60c5\u51b5\u3002<\/p>\n<ol>\n<li>\u67e5\u770b\u63d0\u4ea4\u5386\u53f2<\/li>\n<\/ol>\n<pre>git log<\/pre>\n<p>  \u767b\u5f55\u540e\u590d\u5236   <\/p>\n<p>\u67e5\u770b\u4ee3\u7801\u5e93\u7684\u6240\u6709\u63d0\u4ea4\u8bb0\u5f55\uff0c\u4ee5\u53ca\u6bcf\u6b21\u63d0\u4ea4\u7684\u5177\u4f53\u4fe1\u606f\u3002<\/p>\n<p>\u56db\u3001\u603b\u7ed3<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u4ecb\u7ecd\u4e86\u5982\u4f55\u5728 Mac \u7cfb\u7edf\u4e0a\u5b89\u88c5\u548c\u914d\u7f6e Git\uff0c\u5e76\u5217\u4e3e\u4e86\u4e00\u4e9b\u5e38\u7528\u7684 Git \u547d\u4ee4\u3002\u5bf9\u4e8e\u5f00\u53d1\u8005\u800c\u8a00\uff0cGit \u662f\u4e00\u6b3e\u975e\u5e38\u91cd\u8981\u7684\u5de5\u5177\uff0c\u5b66\u4f1a\u4f7f\u7528 Git \u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u66f4\u597d\u5730\u7ba1\u7406\u4ee3\u7801\uff0c\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u3002\u5982\u679c\u4f60\u8fd8\u6ca1\u6709\u4f7f\u7528 Git \uff0c\u8d76\u5feb\u884c\u52a8\u8d77\u6765\u5427\uff01<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5728Mac\u4e0a\u8bbe\u7f6e Git\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mac\u7cfb\u7edf\u662f\u5f00\u53d1\u8005\u4e2d\u975e\u5e38\u6d41\u884c\u7684\u64cd\u4f5c\u7cfb\u7edf\uff0c\u800c git \u662f\u5927\u5bb6\u6700\u4e3a\u719f\u77e5\u7684\u4ee3\u7801\u7248\u672c\u63a7\u5236\u5de5\u5177\u3002\u4f7f\u7528 git \u6709\u5f88\u591a\u597d\u5904\uff0c\u6bd4\u5982\u65b9\u4fbf\u591a\u4eba\u534f\u540c\u5f00\u53d1\u3001\u7248\u672c\u63a7\u5236\u3001\u5907\u4efd\u7b49\u7b49\u3002\u672c\u6587\u5c06\u4ecb\u7ecd\u5982\u4f55\u5728 mac \u4e0a\u8bbe\u7f6e git\u3002 \u4e00\u3001\u5b89\u88c5 Git Mac \u7cfb\u7edf\u9ed8\u8ba4\u662f\u6ca1\u6709\u5b89\u88c5 Git \u7684\uff0c\u56e0\u6b64\u6211\u4eec\u9700\u8981\u624b\u52a8\u5b89\u88c5\u3002\u6709\u4e24\u79cd\u65b9\u6cd5\u5b89\u88c5 Git \uff1a \u901a\u8fc7 Homebrew \u5b89\u88c5 Homebrew \u662f Mac OS X \u4e0b\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u540c\u6837\u9700\u8981\u5b89\u88c5\u3002\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a \/usr\/bin\/ruby -e &#8220;$(curl -fsSL https:\/\/raw.githubusercontent.com\/Homebrew\/install\/master\/install)&#8221; \u767b\u5f55\u540e\u590d\u5236 \u63a5\u7740\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5 Git \uff1a brew install git \u767b\u5f55\u540e\u590d\u5236 \u4e0b\u8f7d Git \u5b89\u88c5\u5305 \u4ece\u5b98\u7f51 [https:\/\/git-scm.com\/downloads](https:\/\/git-scm.com\/downloads) \u4e0b\u8f7d Git \u5b89\u88c5\u5305\uff0c\u7136\u540e\u6309\u7167\u63d0\u793a\u8fdb\u884c\u5b89\u88c5\u5373\u53ef\u3002 \u4e8c\u3001\u914d\u7f6e Git \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6211\u4eec\u9700\u8981\u914d\u7f6e Git\u3002\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u5982\u4e0b\u547d\u4ee4\u8fdb\u884c\u914d\u7f6e\uff1a \u914d\u7f6e\u7528\u6237\u4fe1\u606f git config &#8211;global user.name [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-19560","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19560","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=19560"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/19560\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=19560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=19560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=19560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}