Experiment a GIT GIT code version management experiment a code version management

Experiment a GIT code version management

 

Purpose:

1) understand the core mechanism of the distributed distributed version control system;

2) git master basic instructions and a branch management instruction;

Experiment:

1) install git

2) the initial configuration git, git init git status command

3) master git log, git add, git diff command

4) master git tag git branch, git commit command

5) master git revert command

Test record :
1.1 install GIT
taking into account downloaded from the website version may not apply, so the students recommended to download and install the version of success.

1.2 Configuration GIT

Git provided their user name, E-mail, and an output color-coded content, and compare the initial state.

1.3 Creating a warehouse from scratch

1) Create a directory called se2020-git-course, in this directory, create another directory called new-git-project, using the cd command to move to the next new-git-project directory.

1.4 clone an existing warehouse and view their status

Methods for cloning in Git is to call the command we'll run in the terminal git clone, then the incoming path to clone the Git repository.

Go to the directory using a command line program, enter git status. If the output: "nothing to commit, working directory clean", meaning success.

1.5 git log command

1) git log command is used to commit the information repository for all displays.

2) git log --oneline warehouse for changing information display

3) git log --stat command can be used to display the file and commit the changes to the number of lines added or deleted.

4) git log -p This command displays a file is modified, the display position of the line where the add / delete, show the actual changes made.

5)git log -w

 

1.6 git add & git commit & git diff

1)在new-git-project里 创建 index.html 文件,添加代码;建立 js 和css 文件夹,并在文件下分别建立 app.js 和 app.css 文件,文件内容可为空。运行git add index.html命令,使用 git add 将 index.html 添加到暂存区。

2)暂存css和js文件
运行git add css/app.css js/app.js指令

 

3)第一次提交commit

进行第一次提交
输入“git commit”,进入编译器进行修改

4)第二次提交commit

使用 git commit 命令提交 commit,并添加提交说明 Add header to blog,运行git status,添加标题后在进行提交。

 

5)git diff

git diff 命令用来查看已经执行但是尚未 commit 的更改:输出:已经修改的文件,添加/删除的行所在的位置,执行的实际更改.

1.7 标签与分支

创建标签失败,不知道什么原因。

分支实战

更改 1 - 添加页面颜色

更改2  一  添加侧栏,向页面上添加一个侧栏。

更改3  一  更改master上的标题

合并冲突

合并失败时,就称为合并冲突。大部分情况下,git 将能够成功地合并分支。但是,有时候 git 无法完全自动地进行合并。合并失败时,就称为合并冲突。

实验总结与体会:

  在实验的过程中,遇到了许多的错误,例如将命令输出,对编译器的配置未成功,命令提交不成功等。以及如何查看退出显示仓库信息等等,自己动手百度,找到问题的关键所在,重新再试几次,就会抵达成功。我觉得这次Git实验能够大大提高我们的编程能力,为后来的学习奠定基础。

思考题:阅读维基百科和百度百科 的Git词条,总结分布式分布式版本控制系统的核心机理.

  分布式版本控制系统没有中央服务器,每个人的电脑上都用一个完整的版本库,只要交换对方的修改就行,把各自的修改推送给对方,不必服务器端软件支持,使源代码的发布和交流极其方便。并且Git是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理,Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。

实验目的:

1)了解分布式分布式版本控制系统的核心机理;

2) 熟练掌握git的基本指令和分支管理指令;

实验内容:

1)安装git

2)初始配置git ,git init git status指令

3)掌握git log ,git add ,git diff 指令

4) 掌握git tag git branch,git commit 指令

5)掌握git revert 指令

实验记录
1.1 安装GIT
考虑到从网站上的下载的版本可能不适用,所以下载了同学们推荐的版本并安装成功。

1.2 配置GIT

设置自己的Git用户名、邮箱及输出内容带有颜色标记,并对比初始状态。

1.3从头创建仓库

1)创建一个目录,叫做 se2020-git-course,在该目录中,创建另一个目录,叫做 new-git-project,使用 cd 命令移到 new-git-project 目录下。

1.4克隆现有仓库并查看其状态

在 Git 上进行克隆的方法是调用我们将在终端上运行的命令 git clone,然后传入要克隆的 Git 仓库的路径。

使用命令行转到项目的目录下,输入 git status 。若输出:"nothing to commit, working directory clean",意味着成功。

1.5 git log命令

1)git log 命令用于显示仓库中所有 commit 的信息。

2)git log --oneline 用于更改仓库信息的显示方式

3) git log --stat命令可以用来显示 commit 中更改的文件以及添加或删除的行数。

4)git log -p此命令用于显示被修改的文件,显示添加/删除的行所在的位置,显示做出的实际更改。

5)git log -w

 

1.6 git add & git commit & git diff

1)在new-git-project里 创建 index.html 文件,添加代码;建立 js 和css 文件夹,并在文件下分别建立 app.js 和 app.css 文件,文件内容可为空。运行git add index.html命令,使用 git add 将 index.html 添加到暂存区。

2)暂存css和js文件
运行git add css/app.css js/app.js指令

 

3)第一次提交commit

进行第一次提交
输入“git commit”,进入编译器进行修改

4)第二次提交commit

使用 git commit 命令提交 commit,并添加提交说明 Add header to blog,运行git status,添加标题后在进行提交。

 

5)git diff

git diff 命令用来查看已经执行但是尚未 commit 的更改:输出:已经修改的文件,添加/删除的行所在的位置,执行的实际更改.

1.7 标签与分支

创建标签失败,不知道什么原因。

分支实战

更改 1 - 添加页面颜色

更改2  一  添加侧栏,向页面上添加一个侧栏。

更改3  一  更改master上的标题

合并冲突

合并失败时,就称为合并冲突。大部分情况下,git 将能够成功地合并分支。但是,有时候 git 无法完全自动地进行合并。合并失败时,就称为合并冲突。

实验总结与体会:

  在实验的过程中,遇到了许多的错误,例如将命令输出,对编译器的配置未成功,命令提交不成功等。以及如何查看退出显示仓库信息等等,自己动手百度,找到问题的关键所在,重新再试几次,就会抵达成功。我觉得这次Git实验能够大大提高我们的编程能力,为后来的学习奠定基础。

思考题:阅读维基百科和百度百科 的Git词条,总结分布式分布式版本控制系统的核心机理.

  分布式版本控制系统没有中央服务器,每个人的电脑上都用一个完整的版本库,只要交换对方的修改就行,把各自的修改推送给对方,不必服务器端软件支持,使源代码的发布和交流极其方便。并且Git是一个开源的分布式版本控制系统,可以有效、高速地处理从很小到非常大的项目版本管理,Git 是 Linus Torvalds 为了帮助管理 Linux 内核开发而开发的一个开放源码的版本控制软件。

Guess you like

Origin www.cnblogs.com/32036et/p/12401002.html