VSCode集成Git代碼管理
阿新 • • 發佈:2017-11-09
lan pyc pan style tag 版本控制 1.0 烏龜 clone
## branch
## tag
在實際使用中,git fetch更安全一些
因為在merge前,我們可以查看更新情況,然後再決定是否合並
一、安裝和配置VSCode與Git
1、下載Git並安裝:
https://git-scm.com/download/
2、下載VSCode並進行安裝:
https://code.visualstudio.com/Download
3、在本地磁盤建立一個目錄打開,初始化存儲:如創建一個TSPWeb目錄,並進入終端命令行
4、使用git命令克隆代碼(會提示輸入git的賬號和密碼):
git clone http://git.cvtsp.com/Cvnavi_Web/TSPWeb.git
5、自己使用VSCode進行開發管理。
二、Git相關的文檔和操作
1. git 文檔
https://github.com/progit/progit/blob/master/zh/02-git-basics/01-chapter2.markdown https://github.com/progit/progit/tree/master/zh http://www.uml.org.cn/pzgl/201204285.asp 如果是windows操作系統,可以裝可視化的版本控制器:小烏龜。這樣的話就不用敲git命令了。小烏龜安裝配置如下: http://blog.chinaunix.net/uid-25806493-id-3319781.html http://my.oschina.net/longxuu/blog/1416992. 常用命令: branch、tag、 pull、fetch
git branch /*查看本地分支*/
git checkout -b daily/1.0.0 /*簽出新分支*/
git checkout daily/1.0.1 /*切換到其他分支*/
git push origin daily/1.0.0 /*push到遠程分支*/
git branch -d daily/1.0.0 /*刪除本地分支*/
git push origin --delete daily/1.0.0 /*刪除遠程分支*/
刪除也可以這樣:git push origin :branch-name
git tag /*查看本地tag*/
git tag -d publish/1.0.0 /*刪除本地tag*/
git push origin --delete tag publish/1.0.0 /*刪除遠程tag*/
##合並遠程分支到本地分支
git fetch origin daily/1.0.0 /*獲取遠程分支*/
git merge origin daily/1.0.0 /*將本地分支與遠程分支合並*/
git pull origin daily/1.0.0 /*獲取並合並遠程分支到本地分支*/
註意: git pull 相當於是從遠程獲取最新版本並merge到本地
因為在merge前,我們可以查看更新情況,然後再決定是否合並
3. git 常用步驟
- 執行
git init
- git checkout -b daily/3.0.0 /*簽出新分支*/
- git add src/test.js /*添加到暫存區*/
- git commit -m "你的提交信息"
- git merge master /*合並分支,可以不做,如果有其它版本的修改,要merge*/
- git push -u origin daily/3.0.0
- git tag publish/3.0.0 /*打tag*/
- git push -u origin publish/3.0.0 發布tag
- git pull origin daily/1.0.0 /*合並遠程分支和本地分支*/
VSCode集成Git代碼管理