如何在VSCode中同步代码到github (on Mac)
来源:互联网 发布:spss如何转换数据 编辑:程序博客网 时间:2024/05/28 05:17
在VSCode中使用git,将本地code提交到github,这本是一件非常容易的事情,就像你在本地开发,然后将代码同步到github上面一样,可是我几乎没往github提交过代码,虽然会在上面查问题,[打脸][打脸][打脸][打脸][打脸]。
先在VSCode中初始化一个本地Repo,这个Repo就会存放从github pull 下来的代码,怎么创建呢?先点出最左侧导航栏的分支图标,在『源代码管理』的后面有个git的logo,点下就会出现了:
我这里创建的Repo名字:testVSCodeSynchr
先添加远程仓库:
git remote add origin https://github.com/stanbers/git-tutorial
再去把这个远程的仓库pull到local:
git pull origin master
这个时候看下本地有没有远程仓库中的README.md(我的远程仓库中目前只有这一个文件):
➜ testVSCodeSynchr git:(master) ls -altotal 8drwxr-xr-x 4 Stan staff 136 11 28 15:25 .drwx------+ 30 Stan staff 1020 11 28 15:22 ..drwxr-xr-x 13 Stan staff 442 11 28 15:26 .git-rw-r--r-- 1 Stan staff 179 11 28 15:25 README.md
可以看到已经pull下来了,把这个文件update 一下:
➜ testVSCodeSynchr git:(master) git statusOn branch masterChanges not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory) modified: README.mdno changes added to commit (use "git add" and/or "git commit -a")➜ testVSCodeSynchr git:(master) ✗
其中添加了一句『coded in my local』,然后提交:
➜ testVSCodeSynchr git:(master) ✗ git add .➜ testVSCodeSynchr git:(master) ✗ git commit -m 'update in my local'[master d4c1b12] update in my local 1 file changed, 2 deletions(-)➜ testVSCodeSynchr git:(master)
再去push到github:
➜ testVSCodeSynchr git:(master) git push origin masterCounting objects: 3, done.Delta compression using up to 8 threads.Compressing objects: 100% (2/2), done.Writing objects: 100% (3/3), 269 bytes | 0 bytes/s, done.Total 3 (delta 1), reused 0 (delta 0)remote: Resolving deltas: 100% (1/1), completed with 1 local object.To https://github.com/stanbers/git-tutorial 834d1ea..d4c1b12 master -> master➜ testVSCodeSynchr git:(master)
这个时候去刷新一下github,不出意外就可以看到更新的内容了:
没毛病,这时候在github上面更新这个README.md, 添加一行『coded in github』,然后再到VSCode中去重新pull下,不出意外应该也可以看到刚才github上面更新的那一行内容:
没毛病,实现了同步,以上都是直接通过命令行来完成的,可以看到我安装了oh my zsh。
阅读全文
0 0
- 如何在VSCode中同步代码到github (on Mac)
- 如何在mac电脑上传代码到github上
- 如何在 Mac 上的 IDEA 上传代码到 GitHub
- 在IntelliJ IDEA中同步代码到华为云git仓库 (on windows)
- 同步代码到github
- 如何在mac中使用github
- mac下如何上传代码到github(亲测有效)
- MAC环境如何将本地代码上传到GitHub上
- mac如何上传本地代码到gitHub上
- mac系统下,如何将代码上传到github
- 本地代码用git同步到GitHub中
- 先在 Xcode 中创建了工程,如何同步到 Github
- 如何在VSCode中配置python环境
- 如何在VScode中过滤.pyc文件
- Mac电脑同步工程到github
- 在eclipse中使用github进行代码的同步操作
- 在Mac中上传代码至GitHub的使用方法
- Mac上的VSCode中格式化代码报错
- java并发编程学习(六) 重排序和顺序一致性
- EnableAutoConfiguration注解的工作原理
- python获取下周周一日期(获取指定周指定周几)
- 第七章:数据过滤
- 如何下载DWG矢量格式的CAD等高线
- 如何在VSCode中同步代码到github (on Mac)
- 20-常用对象API(集合框架练习) 21-常用对象API(集合框架-LinkedHashSet集合).
- 个人博客Blog搭建
- RabbitMQ消息队列(一): Detailed Introduction 详细介绍
- python之位置参数、关键值参数、参数收集
- 什么是跨域?怎么解决跨域问题?
- 数据结构与算法分析 c++ 排序
- springboot 整合shiro
- spring cloud之断路器hystrix(五)