如何给VScode配置git
2018-06-06 本文已影响1307人
鸡蛋_2ab5
如何给VScode配置git
一:首先我们要下载VScode和git,由于我是windows所以git我选择下载msysgit.链接https://git-scm.com/download/win。
二:下载安装完毕之后,我们需要给VScode配置git
(1)为Git配置环境变量,环境变量值为Git安装位置的cmd文件夹,例如我的就是D:\Mysoft\Git\cmd;
(2)打开vscode设置,搜索git.path,将该项值设置为git安装目录的cmd文件夹下的git.exe的所在文件路径;
到这一步为止,我们的vscode已经可以使用git了,下面说一下如何配置本地推送远程仓库。
首先我们打开GitBush,
其次依次输入以下命令

其中第一行命令是指定我们自己本地项目所在文件路径,其实我们也可以在项目文件夹下按住Shift键直接gitbush here,这是同样的效果

剩余几行Git手册里有详细教学,我就不一一解释。
其实vscode本身也简化了git的操作,把命令转化成动作,下面我说一下如何操作,但是不建议大家这么用,用多了就懒了。
(1)我们修改了本地文件

(2)这时文件会被加载到工作区

(3)点击加号暂存更改,等于git add

(4)点击对号提交,等于git commit

(5)最后点击底部的提交,等于git push

这里再推荐廖雪峰老师的git教学。https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000
学无止境,祝大家成为大牛!