1.安装
在vscode中的插件管理输入如下后下载
GitLens — Git supercharged
![](https://img-blog.csdnimg.cn/cbe97700e6cb4d319cc5ddbc0265c296.png)
2.配置
点击文件--首选项--设置
![](https://img-blog.csdnimg.cn/c8c5c865788d4eba97e7be03c0755ae9.png)
点击右上角设置小图标
![](https://img-blog.csdnimg.cn/c53fe9a8c6e24bfe8941a2e4295830b8.png)
3.github使用
首先仓库文件一定是要git init是git所管理的
1.在代码文件夹下使用git init创建仓库
![](https://img-blog.csdnimg.cn/0097373eb56442a5bd41352a02a46b07.png)
![](https://img-blog.csdnimg.cn/dfb26e6d7c304409b864709cd9333583.png)
2.打开vscode的git管理
![](https://img-blog.csdnimg.cn/1d2cd5d2fafa41239f494afc3107b48c.png)
3.点击添加暂存区,再点击提交,可以输入提交内容
单个提交
![](https://img-blog.csdnimg.cn/43d7e9adb4d14ee3bc7f83e7871cf629.png)
全部提交到暂存区
![](https://img-blog.csdnimg.cn/f562e550fbc94caf81bbe4d6e850195b.png)
4.第一次提交默认会让你绑定github,如果你已经登录了,授权下就行了,没有登录gitbuh会弹出如下:
![](https://img-blog.csdnimg.cn/c0acaba9e54841beaf99a0f1faeff4dc.png)
5.绑定完成后会提示要你输入仓库名,并且是私有仓库还是公有仓库,自行选择
输入完成后
![](https://img-blog.csdnimg.cn/6527a16993bf4945afab9a40b773f03e.png)
6.上传成功
![](https://img-blog.csdnimg.cn/90ca895b417b48f8b0e1f243c98905b0.png)
7.验证上传成功
![](https://img-blog.csdnimg.cn/18d44ef9068d47b3a00010d95a0d82b2.png)
4.其他仓库网站使用,比如gitee
1.把第一次上传gitee操作都在git bash的弹窗中实现
2.把创建好的仓库拖到vscode中开始编写代码,只要是更新的了页面就会出现在git管理中,可以全部添加暂存也可以单个文件添加暂存,添加暂存后再点提交到git就自动提交到gitee仓库了
![](https://img-blog.csdnimg.cn/43d7e9adb4d14ee3bc7f83e7871cf629.png)
5.多人协调开发
如果是多人协调的话,写代码之前记得拉一下代码,还有很多操作,都可以研究下
![](https://img-blog.csdnimg.cn/e96809458bcd403f9eaef7ce9cdc5597.png)
6.撤销
使用场景:如果你更改内容查看数据啊,console.log什么的,看完之后又不想保存上传,可以选择撤销操作
单个撤销:
![](https://img-blog.csdnimg.cn/8324289f4c42459bb5e928786970ee84.png)
![](https://img-blog.csdnimg.cn/eaf81c311f124e9b989fc03b692ad9ae.png)
全部撤销:
![](https://img-blog.csdnimg.cn/7e147c245a894ee79f6aa6219342cd27.png)
文章到此结束,希望对你有所帮助~