{"id":514,"title":"git \u547d\u4ee4\u5927\u5168","good":17,"bad":0,"hit":2742,"created_at":"2020-11-28 10:03:55","content":"

git config --global user.name xxx<\/p>

git config --global user.email xx@ss.com<\/p>

<\/p>

git add<\/p>

git status<\/p>

git commit -m 'xxx'<\/p>

<\/p>

git log<\/p>

git log --pretty=oneline<\/p>

git log --oneline<\/p>

git reflog<\/p>

<\/p>

git reset --soft xxx \u4ec5\u5728\u672c\u5730\u5e93\u79fb\u52a8head\u6307\u9488<\/p>

git reset --mixed xxx \u5728\u672c\u5730\u5e93\u79fb\u52a8head\u6307\u9488\uff0c\u91cd\u7f6e\u6682\u5b58\u533a<\/p>

git reset --hard xxx  \u5728\u672c\u5730\u5e93\u79fb\u52a8head\u6307\u9488\uff0c\u91cd\u7f6e\u6682\u5b58\u533a\uff0c\u91cd\u7f6e\u5de5\u4f5c\u533a<\/p>

<\/p>

git diff \u6587\u4ef6\u540d \u5c06\u5de5\u4f5c\u533a\u7684\u6587\u4ef6\u548c\u6682\u5b58\u533a\u8fdb\u884c\u6bd4\u8f83<\/p>

git diff \u672c\u5730\u5e93\u4e2d\u5386\u53f2\u7248\u672c \u6587\u4ef6\u540d \u5c06\u5de5\u4f5c\u533a\u4e2d\u7684\u6587\u4ef6\u548c\u672c\u5730\u5e93\u5386\u53f2\u8bb0\u5f55\u6bd4\u8f83<\/p>

<\/p>

\u521b\u5efa\u5206\u652f<\/p>

git branch \u5206\u652f\u540d<\/p>

\u67e5\u770b\u5206\u652f<\/p>

git branch -v<\/p>

\u5207\u6362\u5206\u652f<\/p>

git checkout \u5206\u652f\u540d<\/p>

\u5408\u5e76\u5206\u652f\uff1a<\/p>

1\u5207\u6362\u5230\u63a5\u53d7\u4fee\u6539\u7684\u5206\u652f\uff08\u88ab\u5408\u5e76\uff0c\u589e\u52a0\u65b0\u5185\u5bb9\u4e0a\uff09,git checkout \u5206\u652f\u540d<\/p>

2git merge \u6709\u65b0\u5185\u5bb9\u7684\u5206\u652f\u540d<\/p>

<\/p>

\u51b2\u7a81\u89e3\u51b3<\/p>

1\u7f16\u8f91\u6587\u4ef6\uff0c<\/p>

2\u6bd4\u8f83\u540e\u4fee\u6539<\/p>

3 git add <\/p>

4 git commit -m 'xx' \u4e0d\u5e26\u6587\u4ef6\u540d<\/p>

<\/p>

fork<\/p>

\u76f8\u5f53\u4e8e\u5907\u4efd\u4e00\u4efd\u5bf9\u65b9\u9879\u76ee\u7684\u4ee3\u7801<\/p>

fork\u540e\u5982\u679c\u5bf9\u65b9\u6709\u66f4\u65b0\u600e\u4e48\u529e\uff1f<\/p>

1\u3001git remote -v<\/p>

2\u3001git remote add upstream \u4ece\u54ea\u4e2afork\u6765\u7684\u5c31\u586b\u54ea\u4e2agit\u5730\u5740<\/p>

3\u3001git fetch upstream<\/p>

4\u3001git merge \u5206\u652f\u540d(\u5c06\u6e90\u4ed3\u5e93\u5206\u652f\u4ee3\u7801\u4e0e\u5f53\u524d\u6240\u5728\u5206\u652f\u5408\u5e76)<\/p>

5\u3001git remote remove upstream\uff08\u5220\u9664upstream)<\/p>

<\/p>

<\/p>

\u5982\u679c\u8fdc\u7a0b\u4ed3\u5e93\u4ee3\u7801\u6539\u4e86\uff0c\u4f46\u672c\u5730\u53c8\u4fee\u6539\u4e86\uff0cgit pull\u4e0d\u4e86\uff0c\u5982\u679c\u4e0d\u60f3\u4fdd\u5b58\u672c\u5730\u4fee\u6539\uff1a<\/p>

git checkout \u6587\u4ef6\u540d\uff0c\u5373\u53ef\u7528\u8fdc\u7a0b\u4ed3\u5e93\u7684\u66ff\u6362\u672c\u5730\u4fee\u6539\u7684<\/p>

<\/p>

\u5220\u9664\u672c\u5730\u5206\u652f\uff1a<\/p>

\u5148\u5207\u6362\u5230\u5176\u5b83\u5206\u652f<\/p>

git branch -D \u8981\u5220\u9664\u7684\u5206\u652f\u540d<\/p>

<\/p>"}