{"id":95046,"date":"2024-05-06T10:33:10","date_gmt":"2024-05-06T02:33:10","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=95046"},"modified":"2024-05-06T10:33:10","modified_gmt":"2024-05-06T02:33:10","slug":"git-student","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/git-student.html","title":{"rendered":"\u73a9\u8f6cGit"},"content":{"rendered":"
\u5bfc\u8bfb<\/td>\n | Git\u662f\u4e00\u79cd\u975e\u5e38\u6d41\u884c\u7684\u5206\u5e03\u5f0f\u7248\u672c\u63a7\u5236\u7cfb\u7edf\uff0c\u5b83\u548c\u5176\u4ed6\u7248\u672c\u63a7\u5236\u7cfb\u7edf\u7684\u4e3b\u8981\u5dee\u522b\u5728\u4e8eGit\u53ea\u5173\u5fc3\u6587\u4ef6\u6570\u636e\u7684\u6574\u4f53\u662f\u5426\u53d1\u751f\u53d8\u5316\uff0c\u800c\u5927\u591a\u6570\u7248\u672c\u5176\u4ed6\u7cfb\u7edf\u53ea\u5173\u5fc3\u6587\u4ef6\u5185\u5bb9\u7684\u5177\u4f53\u5dee\u5f02\uff0c\u8fd9\u7c7b\u7cfb\u7edf\uff08CVS\uff0cSubversion\uff0cPerforce\uff0cBazaar \u7b49\u7b49\uff09\u6bcf\u6b21\u8bb0\u5f55\u6709\u54ea\u4e9b\u6587\u4ef6\u4f5c\u4e86\u66f4\u65b0\uff0c\u4ee5\u53ca\u90fd\u66f4\u65b0\u4e86\u54ea\u4e9b\u884c\u7684\u4ec0\u4e48\u5185\u5bb9\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n git\u4ecb\u7ecd<\/strong><\/div>\n \u5206\u5e03\u5f0f\u76f8\u6bd4\u4e8e\u96c6\u4e2d\u5f0f\u7684\u6700\u5927\u533a\u522b\u5728\u4e8e\u5f00\u53d1\u8005\u53ef\u4ee5\u63d0\u4ea4\u5230\u672c\u5730\uff0c\u6bcf\u4e2a\u5f00\u53d1\u8005\u901a\u8fc7\u514b\u9686\uff08git clone\uff09\uff0c\u5728\u672c\u5730\u673a\u5668\u4e0a\u62f7\u8d1d\u4e00<\/p>\n \u4e2a\u5b8c\u6574\u7684Git\u4ed3\u5e93\u3002\u5bf9\u6bd4\u4e0e\u6211\u4eec\u5927\u90e8\u5206\u4f7f\u7528\u8fc7\u7684SVN\u96c6\u4e2d\u4ee3\u7801\u7ba1\u7406\u6765\u8bf4\uff0cgit\u5bf9\u4e8e\u7ba1\u7406\u4ee3\u7801\u7684\u5b89\u5168\u6027\u66f4\u9ad8\uff0csvn\u670d\u52a1\u5668\u5982\u679c\u6302\u4e86\uff0c<\/p>\n \u90a3\u4e48\u5b83\u7684\u6570\u636e\u5f88\u53ef\u80fd\u5c31\u4f1a\u9762\u4e34\u4e22\u5931\u7684\u5371\u9669\uff0c\u800c\u5bf9\u4e8egit\u6765\u8bf4\uff0c\u5c31\u4e0d\u4f1a\u5b58\u5728\u90a3\u6837\u7684\u4e8b\u60c5\uff0c\u4ee3\u7801\u90fd\u662fgit\u5230\u672c\u5730\u7684\uff0c\u5373\u4f7f\u670d\u52a1\u5668\u6302\u4e86\uff0c<\/p>\n \u4ee3\u7801\u4e5f\u4f9d\u7136\u5b8c\u6574\u7684\u4fdd\u5b58\u3002git\u662f\u7248\u672c\u63a7\u5236\u5668\uff0c\u6bd4\u4f20\u7edf\u7684svn\u5b8c\u5168\u4e0d\u540c\uff0csvn\u662f\u5dee\u5f02\u6bd4\u8f83\uff0c\u79bb\u7ebf\u72b6\u51b5\u4e0b\u4e0d\u80fd\u63d0\u4ea4\u4ee3\u7801\u3002\u800cgit\u662f\u4fdd\u5b58<\/p>\n \u4e86\u5b8c\u6574\u7684\u4ee3\u7801\u5e93\u5728\u672c\u5730\uff0c\u4ee3\u7801\u66f4\u52a0\u5b89\u5168\u3002\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u5019\u63d0\u4ea4\u4ee3\u7801\u3002\u524d\u9762\u6211\u5df2\u7ecf\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u4e86git\u670d\u52a1\u5668\u7684\u642d\u5efa\u65b9\u5f0f\uff0c\u63a5\u4e0b\u6765\u6211<\/p>\n \u4eec\u5c31\u6765\u770b\u770bgit\u547d\u4ee4\u7684\u5177\u4f53\u4f7f\u7528\u65b9\u6cd5\uff01\u6211\u8fd9\u513f\u5c31\u4ecb\u7ecd\u4e00\u4e9b\u5927\u5bb6\u5e38\u89c4\u4f7f\u7528\u7684\uff0c\u5269\u4e0b\u7684\u6211\u7ed9\u5927\u5bb6\u63a8\u8350\u4e00\u4e2a\u7f51\u7ad9\uff0c\u4e0a\u9762\u5bf9git\u6709\u8be6\u7ec6\u7684\u4ecb<\/p>\n \u7ecd\uff0c\u5fd8\u4e86\u53ef\u4ee5\u968f\u65f6\u67e5\u9605\uff01<\/p>\n git\u5b89\u88c5<\/strong><\/div>\n windows\u4e0a\u5b89\u88c5\u65b9\u5f0f\uff0c\u5c31\u662f\u4e0b\u8f7d\u4e00\u4e2agit\u7684\u5ba2\u6237\u7aef\u540d\u53ebgit bash\u5de5\u5177\uff0c\u76f4\u63a5\u5b89\u88c5\u5373\u53ef\uff01\u4e5f\u53ef\u4e0b\u8f7dgit\u7248\u672c\u5c0f\u4e4c\u9f9f\uff01\u6211\u8fd9\u513f\u4ecb\u7ecd<\/p>\n \u7684\u662fgit bash\uff0c\u8ba9\u5927\u5bb6\u719f\u6089git\u547d\u4ee4\u3002<\/p>\n linux\u4e0b\u5b89\u88c5\u65b9\u5f0f\u5c31\u66f4\u7b80\u5355\uff0c\u76f4\u63a5yum -y install git\u5373\u53ef\uff01<\/p>\n git\u4f7f\u7528<\/strong><\/div>\n \u6211\u4eec\u5728\u670d\u52a1\u5668\u4e0a\u521b\u5efa\u4e86\u4e00\u4e2a\u65b0\u7684\u9879\u76eeTestProject<\/p>\n <\/p>\n \u9996\u5148\u4f1a\u7ed9\u4f60\u5206\u914d\u4e00\u4e2a\u7ec4\u548c\u7528\u6237\u540d\u5bc6\u7801\uff0c\u4ee3\u8868\u4f60\u6709\u6743\u9650\u8bbf\u95ee\u8fd9\u4e2a\u9879\u76ee\uff0c\u6211\u4eec\u7b2c\u4e00\u6b65\u5c31\u662f\u9700\u8981\u8bbe\u7f6e\u6211\u4eec\u7684\u7528\u6237\u540d\u548c\u90ae\u7bb1\u5730\u5740\u3002<\/p>\n <\/p>\n \u65b0\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\u5b58\u653e\u9879\u76ee\uff0c\u8fdb\u5165\u6587\u4ef6\uff0c\u53f3\u952e\u9009\u62e9Git Bash Here\u5c31\u53ef\u4ee5\u8fdb\u5165\u6211\u4eec\u7684git\u547d\u4ee4\u884c\u754c\u9762\u63a5\u4e0b\u6765\u7684\u64cd\u4f5c\u5c31\u5728\u91cc\u9762\u8fdb\u884c\u3002<\/p>\n <\/p>\n git config -l\uff08\u67e5\u770b\u914d\u7f6e\u6587\u4ef6\uff09<\/p>\n <\/p>\n \u7b2c\u4e00\u79cd\u60c5\u51b5\u662f\u9879\u76ee\u4e8b\u5148\u4f20\u4e0a\u53bb\u7684\uff0c\u6211\u4eec\u5c31\u53ea\u9700\u8981\u62c9\u53d6\u5230\u672c\u5730\u4f7f\u7528git clone http:\/\/172.16.81.91\/oe\/TestProject.git\uff08\u76f8\u5f53\u4e8esvn\u7684checkout\uff09<\/p>\n <\/p>\n <\/p>\n git status\u968f\u65f6\u67e5\u770b\u4ee3\u7801\u7684\u72b6\u6001\uff0c\u975e\u5e38\u6709\u7528\u7684\u547d\u4ee4<\/p>\n <\/p>\n \u63a5\u4e0b\u6765\u6211\u4eec\u6765\u4fee\u6539test1\u8fd9\u4e2a\u6587\u4ef6\uff0c\u67e5\u770b\u72b6\u6001<\/p>\n <\/p>\n \u63d0\u793atest1\u88ab\u4fee\u6539\u8fc7\uff0c\u63a5\u4e0b\u6765\u6211\u4eec\u5c31\u9700\u8981\u4f7f\u7528git add \u6216\u8005 git commit -a\u63d0\u4ea4\u4ee3\u7801<\/p>\n <\/p>\n git add .\u5c06\u4fee\u6539\u7684\u6587\u4ef6\u6dfb\u52a0\u5230git\u64cd\u4f5c\uff1bgit commit \uff08\u63d0\u4ea4\u4ee3\u7801\uff0c\u4e00\u822c\u8ddf-m\u53c2\u6570\uff0c\u8868\u793a\u6dfb\u52a0\u6ce8\u91ca\uff09<\/p>\n \u73b0\u5728git status\u7684\u72b6\u6001\u5c31\u662fgit push\uff08\u5f53\u6211\u4eec\u63d0\u4ea4\u5b8c\u6210\u5c31\u53ef\u4ee5\u4e0a\u4f20\u4ee3\u7801\u5230\u670d\u52a1\u5668\uff09<\/p>\n <\/p>\n \u6211\u4eec\u4e0a\u670d\u52a1\u5668\u67e5\u770b\u63d0\u4ea4\u7684\u4ee3\u7801<\/p>\n <\/p>\n \u63d0\u4ea4\u5b8c\u6210\uff01<\/p>\n \u7b2c\u4e8c\u79cd\u60c5\u51b5\u5c31\u662f\u6211\u4eec\u670d\u52a1\u5668\u4e0a\u9879\u76ee\u7684\u6587\u4ef6\u5220\u4e86\uff0c\u6211\u4eec\u672c\u5730\u53ef\u4ee5\u4f7f\u7528git pull\u66f4\u65b0\u5230\u6700\u65b0\u6587\u4ef6\uff08\u76f8\u5f53\u4e8esvn\u7684update\uff09<\/p>\n <\/p>\n \u7b2c\u4e09\u79cd\u60c5\u51b5\u63d0\u4ea4\u4ee3\u7801\u5230\u521a\u521b\u5efa\u7684\u7a7a\u9879\u76ee\u4e0a\uff0c\u6211\u4eec\u628aTestProject\u9879\u76ee\u4ece\u670d\u52a1\u5668\u5220\u4e86\uff0c\u91cd\u65b0\u521b\u5efa\u4e00\u6b21\u3002 \u6211\u4eec\u5728TestP\u76ee\u5f55\u4e0b\u91cd\u65b0\u521b\u5efa\u4e00\u4e2a\u6587\u4ef6\u5939\uff0c\u53d6\u540d\u4e3aproject2\uff0c\u5728\u76ee\u5f55\u4e0b\u521b\u5efatest1\u6587\u4ef6<\/p>\n <\/p>\n \u6211\u4eec\u9700\u8981\u5c06\u672c\u5730\u7684\u4ee3\u7801\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u4e4b\u524d\u9700\u8981\u521d\u59cb\u5316\u6587\u4ef6\u5939git init<\/p>\n <\/p>\n \u6dfb\u52a0\u672c\u5730\u4ee3\u7801\u5230\u8fdc\u7a0b\u670d\u52a1\u5668\u4e0agit remote add origin http:\/\/172.16.81.91\/oe\/TestProject.git \u63d0\u4ea4\u4ee3\u7801<\/p>\n <\/p>\n \u4e0a\u4f20\u4ee3\u7801 \u67e5\u770b\u670d\u52a1\u5668\u9879\u76ee\u9a8c\u8bc1 \u4e0a\u9762\u4ecb\u7ecd\u7684\u5c31\u662f\u6211\u4eec\u5e38\u7528\u7684\uff0c\u63a5\u4e0b\u6765\u53ef\u4ee5\u67e5\u770b\u4e0b\u5176\u4ed6\u547d\u4ee4\uff1a<\/p>\n \u67e5\u770b\u5206\u652f\uff1agit branch\r\n\r\n\u521b\u5efa\u5206\u652f\uff1agit branch name\r\n\r\n\u5207\u6362\u5206\u652f\uff1agit checkout name\r\n\r\n\u521b\u5efa+\u5207\u6362\u5206\u652f\uff1agit checkout \u2013b name\r\n\r\n\u5408\u5e76\u67d0\u5206\u652f\u5230\u5f53\u524d\u5206\u652f\uff1agit merge name\r\n\r\n\u5220\u9664\u5206\u652f\uff1agit branch \u2013d name\r\n<\/pre>\n |