被我玩壞的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}}]}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章