被我玩坏的git:除了之前的工作、当网盘用,还能这么玩

{"type":"doc","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"最近家里有小朋友学习Java编程,想让我指导一下,真的是从头开始学啊,我在外面也没什么办法手把手操作啊,正好,下午工作的时候git提交代码,然后灵机一动,跟家里小朋友说,你每天把你练习的代码提交到这里面,我会下载下来看,有不会的地方,跟我说,我也可以直接看你的代码哪里有问题,也能更好的跟你说,但是一个idea引导git就占用了我大量时间,也有了下面的这一套操作"}]},{"type":"blockquote","content":[{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"注:后期我会不定时的把代码和文档上传到我的仓库中,可能比较适合初学者,但是也希望各位大佬能不断的来补充,因为我的仓库中也有面试、文档视频等资料,5年内的程序员应该都能有所帮助"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"话不多说,来看git的操作吧"}]},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"一、Idea中配置Git"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"点击IntelliJ IDEA->Preferences...->Version Control->Git->Path to Git executable:选择Git目录的位置,点击右侧Test按钮测试是否配置成功"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/d7/d792cf367727e2989f0881bbac486ba5.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"二、Idea中配置GitHub"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"点击IntelliJ IDEA->Preferences...->Version Control->GitHub,点击加号,添加GitHub的用户名和密码,登录,完成配置"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/5a/5a899b161e8be01421e8334f60c78b04.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"heading","attrs":{"align":null,"level":1},"content":[{"type":"text","text":"三、项目代码同步到远程仓库"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"1、这里新建了一个SpringBoot项目helloboot,目录结构如下,暂不添加其他文件"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/cc/ccdaea188ff13a9b11793e4b6b25f2a7.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" "}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"2、点击VCS->Import into Version Control->Create Git Repository... 选择该项目,此时左侧文件变为橙色(白色主体下为红色),即在该项目目录下新建仓库成功,相当于在该项目目录下执行git init命令"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ca/cae29d392ec29fd69d4ca03ac593dbb8.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"3、在项目上右键选择Git,选择+Add,此时左侧文件由红色变为绿色,相当于执行git add命令"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/f5/f5357060be5424192bebbf78d55efce6.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"4、在项目上右键选择Git,选择Commit Directory...,提交注释为“初始化项目成功”,此时左侧文件由绿色变为无色,相当于执行git commit -m \"初始化项目成功\""}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/ba/ba761de1a052b3da4f12664575f6a578.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/84/84fa032c987e1516ee8b87b2ec656b1f.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"5、在GitHub新建一个仓库myhelloboot,注意:暂时先不要勾选Initialize this repository with a README,以保证新建仓库是空的"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/07/0735abf4527c315792cd8cf1771a5cfe.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"6、拷贝新建仓库地址,在项目上右键选择Git,选择Repository,选择Remotes...  点击加号来添加远程仓库,粘贴新建仓库地址"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/72/72dc7cee1b9828740f08a30dade05617.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"6、在项目上右键选择Git,选择Repository,选择Push...  点击Push"}]},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/bc/bc6ff5bac9cd784328a4e991cf62b903.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":" 7、刷新网页,项目代码已成功同步到远程仓库"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"image","attrs":{"src":"https://static001.geekbang.org/infoq/22/220da71c0a3f7907a64cdb651ba4e916.jpeg","alt":null,"title":null,"style":null,"href":null,"fromPaste":true,"pastePass":true}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"至此,Idea中通过Git将代码同步到GitHub已经介绍完毕"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"这样的话,我就可以随时关注他学习的成果,然后随时改正,加上之前我写的吧git当作网盘使用,这样当他工作或者学习的时候有些东西学不明白的时候就可以回来看一下,对他的学习是一个很好的帮助,所以,对于刚进入公司或者还在读书的朋友,也可以尝试一下这个形式,应该也会对你有所帮助"}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null},"content":[{"type":"text","text":"我的仓库中已经上传了一些视频和文档的面试学习资料,有需要的,可以自取,"},{"type":"text","marks":[{"type":"strong"}],"text":"需要我的地址的,"},{"type":"link","attrs":{"href":"https://gitee.com/biwangsheng/personal.git","title":""},"content":[{"type":"text","text":"个人仓库地址"}]}]},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}},{"type":"paragraph","attrs":{"indent":0,"number":0,"align":null,"origin":null}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章