Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_git_md_linux
提交
1743d623
S
skill_tree_git_md_linux
项目概览
CSDN 技术社区
/
skill_tree_git_md_linux
通知
15
Star
4
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_git_md_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
1743d623
编写于
1月 21, 2022
作者:
F
feilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加VSCode+Git+fix1
上级
45478929
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
34 addition
and
34 deletion
+34
-34
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/create_repo.md
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/create_repo.md
+13
-13
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/first_commit.md
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/first_commit.md
+10
-10
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_git.md
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_git.md
+6
-6
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_vscode.md
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_vscode.md
+5
-5
未找到文件。
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/create_repo.md
浏览文件 @
1743d623
...
@@ -8,15 +8,15 @@
...
@@ -8,15 +8,15 @@
登陆前如图所示:
登陆前如图所示:


/img/gitcode_01.png)
登陆后如图所示,如果在移动端安装了CSDN App,也可以通过 CSDN App 扫码登陆:
登陆后如图所示,如果在移动端安装了CSDN App,也可以通过 CSDN App 扫码登陆:


/img/gitcode_02.png)
点击右上角的用户头像图标,在下拉菜单里点击“个人主页”,进入你的GitCode个人主页:
点击右上角的用户头像图标,在下拉菜单里点击“个人主页”,进入你的GitCode个人主页:


/img/gitcode_03.png)
**第2步:创建一个Git仓库**
**第2步:创建一个Git仓库**
...
@@ -27,19 +27,19 @@
...
@@ -27,19 +27,19 @@
新建项目按钮如图所示:
新建项目按钮如图所示:


/img/gitcode_04.png)
选择创建空白项目如图所示:
选择创建空白项目如图所示:


/img/gitcode_05.png)
“创建空白项目”配置页面填写“项目名称”,“项目描述”,并勾选“使用自述文件初始化仓库”。例如这里第一个项目起名叫做“hello_git”
“创建空白项目”配置页面填写“项目名称”,“项目描述”,并勾选“使用自述文件初始化仓库”。例如这里第一个项目起名叫做“hello_git”


/img/gitcode_06.png)
点击“新建项目”后,如图所示:
点击“新建项目”后,如图所示:


/img/gitcode_07.png)
**第3步:使用Git命令克隆仓库到本机**
**第3步:使用Git命令克隆仓库到本机**
...
@@ -48,27 +48,27 @@
...
@@ -48,27 +48,27 @@
如图所示,点击仓库页面上的“克隆”按钮,选择“通过 HTTPS Clone 项目”的地址,并拷贝。这里示例的是:https://gitcode.net/huanhuilong/hello_git.git
如图所示,点击仓库页面上的“克隆”按钮,选择“通过 HTTPS Clone 项目”的地址,并拷贝。这里示例的是:https://gitcode.net/huanhuilong/hello_git.git


/img/gitcode_08.png)
如图所示,在本机打开“终端”,输入命令
`pwd`
,并回车,查看当前终端环境下的工作目录位置,下图显示当前目录在Mac系统个人用户目录下。
如图所示,在本机打开“终端”,输入命令
`pwd`
,并回车,查看当前终端环境下的工作目录位置,下图显示当前目录在Mac系统个人用户目录下。


/img/gitcode_09.png)
如图所示,我们希望将终端环境的工作目录切换到桌面。输入命令
`cd /Users/feilong/Desktop`
,并回车,进入到桌面。再次输入
`pwd`
并回车可以看到工作目录已经切换到了桌面。(注意这里的"feilong"应该替换为你自己的Mac系统用户名)
如图所示,我们希望将终端环境的工作目录切换到桌面。输入命令
`cd /Users/feilong/Desktop`
,并回车,进入到桌面。再次输入
`pwd`
并回车可以看到工作目录已经切换到了桌面。(注意这里的"feilong"应该替换为你自己的Mac系统用户名)


/img/gitcode_10.png)
如图所示,现在我们使用 Git 命令来克隆前一节创建的 Git 仓库。输入命令
`git clone https://gitcode.net/huanhuilong/hello_git.git`
,并回车。
如图所示,现在我们使用 Git 命令来克隆前一节创建的 Git 仓库。输入命令
`git clone https://gitcode.net/huanhuilong/hello_git.git`
,并回车。


/img/gitcode_11.png)
如图所示,Git 会将在GitCode上创建的仓库克隆到本机:
如图所示,Git 会将在GitCode上创建的仓库克隆到本机:


/img/gitcode_12.png)
如图所示,此时Mac电脑的桌面上已经有了"hello_git"这个目录:
如图所示,此时Mac电脑的桌面上已经有了"hello_git"这个目录:


/img/gitcode_13.png)
**第4步:请回答问题**
:
**第4步:请回答问题**
:
...
...
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/first_commit.md
浏览文件 @
1743d623
...
@@ -2,43 +2,43 @@
...
@@ -2,43 +2,43 @@
如图所示,在VSCode的左侧导航列表里,使用右键菜单新建一个目录:doc,并在doc目录下新建一个MarkDown文件
`test.md`
如图所示,在VSCode的左侧导航列表里,使用右键菜单新建一个目录:doc,并在doc目录下新建一个MarkDown文件
`test.md`


/img/first_commit_01.png)
如图所示,在
`test.md`
里编辑几行MarkDown文本(MarkDown语法请学习本技能树第二章),并保存。
如图所示,在
`test.md`
里编辑几行MarkDown文本(MarkDown语法请学习本技能树第二章),并保存。


/img/first_commit_02.png)
如图所示,点击VSCode左侧的“Git面板按钮”,切换左侧导航栏。可以看到按钮上也显示里一个数字1,表示有一个文件发生变动。这里是新增了一个test.md文件。
如图所示,点击VSCode左侧的“Git面板按钮”,切换左侧导航栏。可以看到按钮上也显示里一个数字1,表示有一个文件发生变动。这里是新增了一个test.md文件。


/img/first_commit_03.png)
如图所示,在“源代码管理”下的输入框里输入一个提交信息,这里输入“第一次提交”。
如图所示,在“源代码管理”下的输入框里输入一个提交信息,这里输入“第一次提交”。


/img/first_commit_04.png)
如图所示,在打勾图标的“提交”按钮,将文件的变动提交到Git本地。注意这里的提交只是将变动的文件提交到Git的本地索引系统里,还并不是提交到Git远程仓库。
如图所示,在打勾图标的“提交”按钮,将文件的变动提交到Git本地。注意这里的提交只是将变动的文件提交到Git的本地索引系统里,还并不是提交到Git远程仓库。


/img/first_commit_05.png)
如图所示,弹框会提示你还没有可提交到暂存更改。这是由于将文件变动提交到Git本地索引是需要两个步骤的,先将文件变动加入到暂存更改,再将暂存更改提交到Git本地索引。这里只需要点击「是」,VSCode会自动把两个步骤都做掉。
如图所示,弹框会提示你还没有可提交到暂存更改。这是由于将文件变动提交到Git本地索引是需要两个步骤的,先将文件变动加入到暂存更改,再将暂存更改提交到Git本地索引。这里只需要点击「是」,VSCode会自动把两个步骤都做掉。


/img/first_commit_06.png)
如图所示,提交后,VSCode左侧按钮栏的“Git面板按钮”上的数字消失了。我们希望将本地修改推送到GitCode的远程仓库。但是GitCode仓库上,仓库的其他成员可能也添加了文件,因此一般需要在推送前先拉取下变动到本机,如果拉取的过程中远程仓库的文件和本地的文件有冲突,则需要解决冲突,如何解决冲突不在本节考虑的范围。
如图所示,提交后,VSCode左侧按钮栏的“Git面板按钮”上的数字消失了。我们希望将本地修改推送到GitCode的远程仓库。但是GitCode仓库上,仓库的其他成员可能也添加了文件,因此一般需要在推送前先拉取下变动到本机,如果拉取的过程中远程仓库的文件和本地的文件有冲突,则需要解决冲突,如何解决冲突不在本节考虑的范围。


/img/first_commit_10.png)
如图所示,我们进一步点击下来菜单,点击“推送”按钮,将Git仓库的本地索引变动推送到GitCode上的远程仓库。
如图所示,我们进一步点击下来菜单,点击“推送”按钮,将Git仓库的本地索引变动推送到GitCode上的远程仓库。


/img/first_commit_07.png)
如图所示,Mac系统可能会提示你输入GitCode仓库的用户名密码,或者之前已经配置过,但是首次推送也会提示是否允许使用。根据提示做相应的授权即可。
如图所示,Mac系统可能会提示你输入GitCode仓库的用户名密码,或者之前已经配置过,但是首次推送也会提示是否允许使用。根据提示做相应的授权即可。


/img/first_commit_08.png)
如图所示,推送成功后,打开GitCode的 hello_git 仓库,可以看到新增的doc/test.md文件已经提交到仓库。
如图所示,推送成功后,打开GitCode的 hello_git 仓库,可以看到新增的doc/test.md文件已经提交到仓库。


/img/first_commit_09.png)
经过这些操作,你已经学会了在VSCode里给Git仓库添加文件,提交到Git本地索引,拉取远程Git仓库变动到本机,再推送本地Git仓库的变动到远程仓库。以下描述错误的是?
经过这些操作,你已经学会了在VSCode里给Git仓库添加文件,提交到Git本地索引,拉取远程Git仓库变动到本机,再推送本地Git仓库的变动到远程仓库。以下描述错误的是?
...
...
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_git.md
浏览文件 @
1743d623
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
2.
在“访达” 中,打开“/应用程序/实用工具”文件夹,然后连按“终端”。
2.
在“访达” 中,打开“/应用程序/实用工具”文件夹,然后连按“终端”。
3.
打开的“终端”一般如下图所示:
3.
打开的“终端”一般如下图所示:


/img/install_git_01.png)
**第二步,请执行以操作安装Mac下的包管理软件:`brew`。**
**第二步,请执行以操作安装Mac下的包管理软件:`brew`。**
...
@@ -19,11 +19,11 @@
...
@@ -19,11 +19,11 @@
安装过程如图所示:
安装过程如图所示:


/img/install_git_02.png)
安装成功后,如图所示:
安装成功后,如图所示:


/img/install_git_03.png)
**第三步,请执行以操作,使用刚刚安装的 `brew` 来安装 `git` 的最新版本。**
**第三步,请执行以操作,使用刚刚安装的 `brew` 来安装 `git` 的最新版本。**
...
@@ -35,16 +35,16 @@
...
@@ -35,16 +35,16 @@
开始安装如图所示:
开始安装如图所示:


/img/install_git_04.png)
安装过程如图所示:
安装过程如图所示:


/img/install_git_05.png)
安装成功如图所示:
安装成功如图所示:


/img/install_git_06.png)
好了,经过上述操作,你已经成功在Mac系统上使用终端安装了git的最新版本。以下说法错误的是?
好了,经过上述操作,你已经成功在Mac系统上使用终端安装了git的最新版本。以下说法错误的是?
...
...
data/1.gml初阶/1.Git入门/7.极简Git+VSCode(Mac)/install_vscode.md
浏览文件 @
1743d623
...
@@ -13,19 +13,19 @@
...
@@ -13,19 +13,19 @@
11.
当然,也可以在打开VSCode后,通过菜单“文件->打开文件夹”的方式打开 hello_git 目录。取决于你更喜欢命令行还是GUI操作。
11.
当然,也可以在打开VSCode后,通过菜单“文件->打开文件夹”的方式打开 hello_git 目录。取决于你更喜欢命令行还是GUI操作。
如图所示,下载VSCode并安装:
如图所示,下载VSCode并安装:


/img/vscode_01.png)
如图所示,安装code命令到终端:
如图所示,安装code命令到终端:


/img/vscode_02.png)
如图所示,在命令下使用
`code .`
命令打开仓库,这里的
`.`
表示当前目录。
如图所示,在命令下使用
`code .`
命令打开仓库,这里的
`.`
表示当前目录。


/img/vscode_03.png)
如果所示,VSCode里打开了仓库目录,会提示是否信任目录,点击信任。
如果所示,VSCode里打开了仓库目录,会提示是否信任目录,点击信任。


/img/vscode_04.png)
如图所示,VSCode打开了 hello_git 仓库,点击“README.md”文件并显示
如图所示,VSCode打开了 hello_git 仓库,点击“README.md”文件并显示


/img/vscode_05.png)
经过上述操作,你已经学会安装VSCode并打开Git仓库了,以下描述错误的是?
经过上述操作,你已经学会安装VSCode并打开Git仓库了,以下描述错误的是?
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录