id: 8e27eda3aa244893bc2b5a5b2a50b6ff
parent_id: 
item_type: 1
item_id: 678494122e084ec083abe7e2b8818a92
item_updated_time: 1764345511812
title_diff: "[{\"diffs\":[[1,\"如何使用git 把本地代码更新到GitHub上\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":23}]"
body_diff: "[{\"diffs\":[[1,\"<html>\\\r\\\n<head>\\\r\\\n  <title>如何使用git 把本地代码更新到GitHub上</title>\\\r\\\n  <basefont face=\\\"微软雅黑\\\" size=\\\"2\\\" />\\\r\\\n  <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html;charset=utf-8\\\" />\\\r\\\n  <meta name=\\\"exporter-version\\\" content=\\\"YXBJ Windows/608924 (zh-CN, DDL); Windows/10.0.0 (Win64); EDAMVersion=V2;\\\"/>\\\r\\\n  <style>\\\r\\\n\\tbody, td {\\\r\\\n\\t  font-family: 微软雅黑;\\\r\\\n\\t  font-size: 12pt;\\\r\\\n\\t}\\\r\\\n  </style>\\\r\\\n</head>\\\r\\\n<body>\\\r\\\n<a name=\\\"45588\\\"></a>\\\r\\\n<h1>如何使用git 把本地代码更新到GitHub上</h1>\\\r\\\n\\\r\\\n<div><span>\\\n  <div style=\\\"--en-clipped-content:simplified\\\"><div style=\\\"font-size: 16px; display:block; min-width: 100%;\\\"> <div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;\\\"><div style=\\\"background-color:transparent;font:inherit;vertical-align:baseline;font-family:&quot;PT Serif&quot;;font-size:16px;line-height:1.5em;color:rgb(31, 9, 9);text-align:left;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;width:36em;z-index:200;padding-left:2em;padding-right:2em;margin-left:auto;margin-right:auto;position:relative;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-left:-25px;margin-right:25px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;padding-top:0px;padding-bottom:9em;position:relative;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><h1 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;border:0px;font:inherit;vertical-align:baseline;font-size:35px;font-weight:normal;line-height:35px;margin-bottom:20px;padding:0px;margin:0px;\\\">如何使用git 把本地代码更新到GitHub上</h1><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;position:relative;height:1em;line-height:1;text-align:center;margin:0px;padding-top:1.5em;padding-bottom:1.5em;margin-bottom:0px;\\\"><div style=\\\"padding:0px;border:0px;font:inherit;vertical-align:baseline;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;opacity:0.5;margin:0px;margin-bottom:0px;\\\"><span style=\\\"font:inherit;position:absolute;left:-4em;top:50%;z-index:10;width:100%;padding-left:4em;padding-right:4em;height:0.1em;margin:0px;opacity:0.5;background:-webkit-linear-gradient(0deg, rgb(243, 242, 238) 1%, rgb(31, 9, 9) 50%, rgb(243, 242, 238) 99%);\\\"></span></div></div></div><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\">6 人赞同了该文章</div></div></div><h2 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:15px;\\\">1：<a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=git+status&amp;zhida_source=entity\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(31, 9, 9);text-decoration:none;\\\" target=\\\"_blank\\\">git status</a></h2><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">进入到需要更新的目录下，输入git status，查看文件修改的状态。红色的就是修改过的文件。</p><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;margin-bottom:1em;margin-top:1em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;text-align:center;margin-top:1em;margin-bottom:0px;\\\"><img src=\\\":/d516a04624f64900816898167c1f1200\\\" type=\\\"image/jpeg\\\" data-filename=\\\"v2-5b6735fed3dde1918158c9c220165f09_r.jpg\\\" height=\\\"457\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;max-width:100%;\\\" width=\\\"576\\\"/></div></div></div><h2 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:15px;\\\">2：<a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=git+add&amp;zhida_source=entity\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(31, 9, 9);text-decoration:none;\\\" target=\\\"_blank\\\">git add</a>  *</h2><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">键入git add  *，把所有文件都加入，这时候在输入git status，就看到编程了绿色。这个时候文件已经添加都本地仓库了</p><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;margin-bottom:1em;margin-top:1em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;text-align:center;margin-top:1em;margin-bottom:0px;\\\"><img src=\\\":/5504704f33034354a5454909a36a3769\\\" type=\\\"image/jpeg\\\" data-filename=\\\"v2-959ffd790aba1097dd0e99c522369959_r.jpg\\\" height=\\\"586\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;max-width:100%;\\\" width=\\\"576\\\"/></div></div></div><h2 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:15px;\\\">3：<a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=git+commit&amp;zhida_source=entity\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(31, 9, 9);text-decoration:none;\\\" target=\\\"_blank\\\">git commit</a> -m &quot;update&quot;. </h2><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">将add的文件commit到仓库</p><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;margin-bottom:1em;margin-top:1em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;text-align:center;margin-top:1em;margin-bottom:0px;\\\"><img src=\\\":/06893f5d7b6141a59cf4432307dac3df\\\" type=\\\"image/jpeg\\\" data-filename=\\\"v2-754dce4bfcbf0b0123f379e1d53e35d5_r.jpg\\\" height=\\\"355\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;max-width:100%;\\\" width=\\\"576\\\"/></div></div></div><h2 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:15px;\\\">4：<a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=git+push&amp;zhida_source=entity\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;color:rgb(31, 9, 9);text-decoration:none;\\\" target=\\\"_blank\\\">git push</a> -u origin main</h2><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">将代码上传到GitHub。</p><h2 style=\\\"font-family:&quot;PT Serif&quot;;text-align:left;margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;font-weight:bold;font-size:30px;line-height:35px;margin-top:35px;margin-bottom:15px;\\\">5：备注：</h2><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">1：如果遇到commit 过的，但是没有push成功的文件。 使用<a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=git+reset+HEAD%5E1&amp;zhida_source=entity\\\" style=\\\"color:rgb(6, 85, 136);margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;text-decoration:none;\\\" target=\\\"_blank\\\">git reset HEAD^1</a> 回退到上个版本</p><p style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;\\\">2：<span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">如果遇到没有push 成功的，报错如下，并且确信只有你一个人在操作GitHub时，进行</span><a href=\\\"https://zhida.zhihu.com/search?content_id=178789872&amp;content_type=Article&amp;match_order=1&amp;q=%E5%BC%BA%E5%88%B6push&amp;zhida_source=entity\\\" style=\\\"color:rgb(6, 85, 136);margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;text-decoration:none;\\\" target=\\\"_blank\\\"><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\">强制push</span></a><span style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;background-color:rgb(234, 226, 96);transition:background-color 0.4s;color:black;font-weight:inherit;font-style:unset;-evernote-highlight:true;\\\" title=\\\"点击以取消高亮显示\\\"> . 输入 git push -f origin main.</span></p><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;margin-bottom:1em;margin-top:1em;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:0px;\\\"><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;text-align:center;margin-top:1em;margin-bottom:0px;\\\"><img src=\\\":/c2894949f36c4c938d9b8631bd51aad9\\\" type=\\\"image/jpeg\\\" data-filename=\\\"v2-3a869cb8506348b5b39101924d69b88e_r.jpg\\\" height=\\\"128\\\" style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;display:block;max-width:100%;\\\" width=\\\"576\\\"/></div></div></div><br/><br/></div></div></div><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;margin-bottom:1.5em;position:absolute;top:-1000px;left:-1000px;\\\">Measure</div><div style=\\\"margin:0px;padding:0px;border:0px;font:inherit;vertical-align:baseline;position:absolute;top:-1000px;left:-1000px;line-height:1;margin-bottom:0px;\\\">Measure</div></div></div></div></div></div></div></div></div>\\\n</span>\\\n</div></body></html>\\u0000\"]],\"start1\":0,\"start2\":0,\"length1\":0,\"length2\":10908}]"
metadata_diff: {"new":{"id":"678494122e084ec083abe7e2b8818a92","parent_id":"061de1401cfc4cfaadf6e74e015970e9","latitude":"0.00000000","longitude":"0.00000000","altitude":"0.0000","author":"","source_url":"","is_todo":0,"todo_due":0,"todo_completed":0,"source":"joplin-desktop","source_application":"net.cozic.joplin-desktop","application_data":"","order":1764345861238,"markup_language":2,"is_shared":0,"share_id":"","conflict_original_id":"","master_key_id":"","user_data":"","deleted_time":0},"deleted":[]}
encryption_cipher_text: 
encryption_applied: 0
updated_time: 2025-11-28T16:20:22.997Z
created_time: 2025-11-28T16:20:22.997Z
type_: 13