Git Git use of installation and use

Git use

 

Git history

Like many of life's great events, Git was born in a highly innovative era of large-scale disputes. Linux kernel open source project has a wide number of public participants. The vast majority of the Linux kernel maintenance work is spent submitting patches and save the archive tedious affairs (1991 - Year 2002). By 2002, the entire project team began to enable distributed version control system BitKeeper to manage and maintain the code.

By the year 2005, when the company developed BitKeeper business relationship with the open source Linux kernel community's end, they recovered the power of free use of BitKeeper. This has forced the Linux open source community (especially Linux founder Linus Torvalds) had to learn, only to develop their own set of version control systems if they are not making the same mistakes. They set a number of objectives for the new system:

• Speed

• simple design

• strong support for the development of non-linear mode (allows thousands of parallel development branch)

• Fully distributed

• have the ability to efficiently manage large scale projects like the Linux kernel is similar to (speed and data volume)

 

the Git comparison with svn

2.1 Svn

SVN is centralized version control system, the repository is focused on the central server, and work time, are used in their computers, so first of all from a central server where to get the latest version, and then to work, finish , we need to finish the job on their own to a central server. Centralized version control system must be networked to work, if it can, the bandwidth is large enough in LAN, fast enough, if in the Internet, if Suman, then it is depressed.

The figure is a standard, centralized version control tool management:

 

 

 

 

Centralized management to some extent to see what other developers, and administrators can easily grasp each person's development rights.

But compared to its advantage, the centralized version control tools shortcomings are obvious:

l Server single point of failure

l fault tolerance difference

2.2 Git

Git is a distributed version control system, then it has no central server, each person's computer is a complete repository, so that when things do not need to work, because the versions are on your own computer. Since everyone's computer has a complete repository, how much how individuals collaborate it? For example, to change their own files on the computer A, the others are changed A file on the computer, then, you just need to give each other their own changes pushed between the two, we can see each other's changed.

The figure is a distributed version control tool management:

 

G IT workflow

The general workflow is as follows:

1. Clone remote Git repository as a resource from a local warehouse.

2. From the local repository the code and code modifications checkout

3. First submitted to the staging area code before submitting.

4. Submitted. Submitted to the local repository. Local warehouses to save each modified version of history.

5. After modifications are complete, team members when needed and share code, the code can push to a remote repository.

The following figure shows a Git workflow:

 

4 How to use Git

1. Create a new folder

3.2 Installation Operation

    

  3.3 Simplified Chinese

    

 

 2 In the folder, right-Git Bash here to enter commands into a local repository folder

It will generate a hidden folder 4.3 folder into a local repository

 

 

Click on the hook hidden items

4.4 Create a new file and add the files to the staging area, right-click the file to add Tortoise

 

4.5 will be submitted to the staging area to a local warehouse

 

4.6 modify the file

 

 

 

 Click Submit on the line

7, delete files

  7.1 deleting a file needs to be submitted again

 

(To be submitted after the deletion, and modification steps as) 

8. Restore Files

  8.1 in HelloGit file modification can be submitted without reduction

  9, the project will be submitted to the repository

9.1 casually take a copy to the directory project

 

 9.2 Ignored Files or Folders

 Select this option

 

 

Here .gitignore action: Enter a project name that you do not upload as inside:

 

 This springcloud_chop01 do not want to upload to copy what the name on the following:

 

 

10 remote warehouse 

  Is commonly used remote repository GitHub: https://github.com/ , you need to create user  

  10.1添加远程库

   (1)在github上创建仓库

    

 

10.2 ssh协议

  (1) 什么是ssh

    SSH 为 Secure Shell(安全外壳协议)的缩写,由 IETF 的网络小组(Network Working Group)所制定。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。

  (2)shh密钥生成 ssh-keygen -t rsa

 

 执行命令完成后,在window本地用户.ssh目录

 

 

(3)ssh密钥配置

    

     

右键记事本打开公钥

 

10.3 同步到远程仓库  

  两条命令:

  git remote add origin [email protected]:myyyplus/git_test.git

  git push -u origin master

 

 

 

 

  

   

 10.4 使用TortoiseGit同步

  

 10.4 使用TortoiseGit同步

Url,推送URL:远程仓库的地址

 

 (1)推送

 

 

 

 

 

 

10.5从远程仓库克隆

      

   

Git历史

同生活中的许多伟大事件一样,Git 诞生于一个极富纷争大举创新的年代。Linux 内核开源项目有着为数众广的参与者。绝大多数的 Linux 内核维护工作都花在了提交补丁和保存归档的繁琐事务上(1991-2002年间)。到 2002 年,整个项目组开始启用分布式版本控制系统 BitKeeper 来管理和维护代码。

到 2005 年的时候,开发 BitKeeper 的商业公司同 Linux 内核开源社区的合作关系结束,他们收回了免费使用 BitKeeper 的权力。这就迫使 Linux 开源社区(特别是 Linux的缔造者 Linus Torvalds )不得不吸取教训,只有开发一套属于自己的版本控制系统才不至于重蹈覆辙。他们对新的系统订了若干目标:

• 速度

• 简单的设计

• 对非线性开发模式的强力支持(允许上千个并行开发的分支)

• 完全分布式

• 有能力高效管理类似 Linux 内核一样的超大规模项目(速度和数据量)

 

Git与svn对比

2.1 Svn

SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首先要从中央服务器哪里得到最新的版本,然后干活,干完后,需要把自己做完的活推送到中央服务器。集中式版本控制系统是必须联网才能工作,如果在局域网还可以,带宽够大,速度够快,如果在互联网下,如果网速慢的话,就郁闷了。

下图就是标准的集中式版本控制工具管理方式:

 

 

 

 

集中管理方式在一定程度上看到其他开发人员在干什么,而管理员也可以很轻松掌握每个人的开发权限。

但是相较于其优点而言,集中式版本控制工具缺点很明显:

l 服务器单点故障

l 容错性差

2.2 Git

Git是分布式版本控制系统,那么它就没有中央服务器的,每个人的电脑就是一个完整的版本库,这样,工作的时候就不需要联网了,因为版本都是在自己的电脑上。既然每个人的电脑都有一个完整的版本库,那多个人如何协作呢?比如说自己在电脑上改了文件A,其他人也在电脑上改了文件A,这时,你们两之间只需把各自的修改推送给对方,就可以互相看到对方的修改了。

下图就是分布式版本控制工具管理方式:

 

git工作流程

一般工作流程如下:

1.从远程仓库中克隆 Git 资源作为本地仓库。

2.从本地仓库中checkout代码然后进行代码修改

3.在提交前先将代码提交到暂存区。

4.提交修改。提交到本地仓库。本地仓库中保存修改的各个历史版本。

5.在修改完成后,需要和团队成员共享代码时,可以将代码push到远程仓库。

下图展示了 Git 的工作流程:

 

4 如何使用Git

1.新建文件夹

3.2 安装操作

    

  3.3 简体中文设置

    

 

 2 在 文件夹中右键Git Bash here输入命令把文件夹变为本地仓库

4.3 文件夹变为本地仓库时会生成一个隐藏文件夹

 

 

点击查看把隐藏的项目勾上

4.4 新建一个文件并把该文件添加到暂存区右键文件Tortoise点击 添加

 

4.5 将暂存区提交到本地仓库

 

4.6修改文件

 

 

 

 点击提交就行了

7、删除文件

  7.1 删除文件操作需要再一次进行提交

 

(删除后要提交,步骤和修改一样) 

8、还原文件

  8.1 在HelloGit文件进行修改不用提交便可还原

  9、将工程提交到版本库

9.1随便拿一个工程复制到目录中

 

 9.2设置忽略文件或文件夹

 选择这个选项

 

 

这里的.gitignore作用:在里面输入你不上传的工程名字如:

 

 不想上传这个springcloud_chop01就复制一下这个名字放在如下:

 

 

10、远程仓库 

  常用的远程仓库就是github:https://github.com/, 需要创建用户  

  10.1添加远程库

   (1)在github上创建仓库

    

 

10.2 ssh协议

  (1) 什么是ssh

    SSH 为 Secure Shell(安全外壳协议)的缩写,由 IETF 的网络小组(Network Working Group)所制定。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。

  (2)shh密钥生成 ssh-keygen -t rsa

 

 执行命令完成后,在window本地用户.ssh目录

 

 

(3)ssh密钥配置

    

     

右键记事本打开公钥

 

10.3 同步到远程仓库  

  两条命令:

  git remote add origin [email protected]:myyyplus/git_test.git

  git push -u origin master

 

 

 

 

  

   

 10.4 使用TortoiseGit同步

  

 10.4 使用TortoiseGit同步

Url,推送URL:远程仓库的地址

 

 (1)推送

 

 

 

 

 

 

10.5从远程仓库克隆

      

   

同生活中的许多伟大事件一样,Git 诞生于一个极富纷争大举创新的年代。Linux 内核开源项目有着为数众广的参与者。绝大多数的 Linux 内核维护工作都花在了提交补丁和保存归档的繁琐事务上(1991-2002年间)。到 2002 年,整个项目组开始启用分布式版本控制系统 BitKeeper 来管理和维护代码。

到 2005 年的时候,开发 BitKeeper 的商业公司同 Linux 内核开源社区的合作关系结束,他们收回了免费使用 BitKeeper 的权力。这就迫使 Linux 开源社区(特别是 Linux的缔造者 Linus Torvalds )不得不吸取教训,只有开发一套属于自己的版本控制系统才不至于重蹈覆辙。他们对新的系统订了若干目标:

• 速度

• 简单的设计

• 对非线性开发模式的强力支持(允许上千个并行开发的分支)

• 完全分布式

• 有能力高效管理类似 Linux 内核一样的超大规模项目(速度和数据量)

 

Git与svn对比

2.1 Svn

SVN是集中式版本控制系统,版本库是集中放在中央服务器的,而干活的时候,用的都是自己的电脑,所以首先要从中央服务器哪里得到最新的版本,然后干活,干完后,需要把自己做完的活推送到中央服务器。集中式版本控制系统是必须联网才能工作,如果在局域网还可以,带宽够大,速度够快,如果在互联网下,如果网速慢的话,就郁闷了。

下图就是标准的集中式版本控制工具管理方式:

 

 

 

 

集中管理方式在一定程度上看到其他开发人员在干什么,而管理员也可以很轻松掌握每个人的开发权限。

但是相较于其优点而言,集中式版本控制工具缺点很明显:

l 服务器单点故障

l 容错性差

2.2 Git

Git是分布式版本控制系统,那么它就没有中央服务器的,每个人的电脑就是一个完整的版本库,这样,工作的时候就不需要联网了,因为版本都是在自己的电脑上。既然每个人的电脑都有一个完整的版本库,那多个人如何协作呢?比如说自己在电脑上改了文件A,其他人也在电脑上改了文件A,这时,你们两之间只需把各自的修改推送给对方,就可以互相看到对方的修改了。

下图就是分布式版本控制工具管理方式:

 

git工作流程

一般工作流程如下:

1.从远程仓库中克隆 Git 资源作为本地仓库。

2.从本地仓库中checkout代码然后进行代码修改

3.在提交前先将代码提交到暂存区。

4.提交修改。提交到本地仓库。本地仓库中保存修改的各个历史版本。

5.在修改完成后,需要和团队成员共享代码时,可以将代码push到远程仓库。

下图展示了 Git 的工作流程:

 

4 如何使用Git

1.新建文件夹

3.2 安装操作

    

  3.3 简体中文设置

    

 

 2 在 文件夹中右键Git Bash here输入命令把文件夹变为本地仓库

4.3 文件夹变为本地仓库时会生成一个隐藏文件夹

 

 

点击查看把隐藏的项目勾上

4.4 新建一个文件并把该文件添加到暂存区右键文件Tortoise点击 添加

 

4.5 将暂存区提交到本地仓库

 

4.6修改文件

 

 

 

 点击提交就行了

7、删除文件

  7.1 删除文件操作需要再一次进行提交

 

(删除后要提交,步骤和修改一样) 

8、还原文件

  8.1 在HelloGit文件进行修改不用提交便可还原

  9、将工程提交到版本库

9.1随便拿一个工程复制到目录中

 

 9.2设置忽略文件或文件夹

 选择这个选项

 

 

这里的.gitignore作用:在里面输入你不上传的工程名字如:

 

 不想上传这个springcloud_chop01就复制一下这个名字放在如下:

 

 

10、远程仓库 

  常用的远程仓库就是github:https://github.com/, 需要创建用户  

  10.1添加远程库

   (1)在github上创建仓库

    

 

10.2 ssh协议

  (1) 什么是ssh

    SSH 为 Secure Shell(安全外壳协议)的缩写,由 IETF 的网络小组(Network Working Group)所制定。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。

  (2)shh密钥生成 ssh-keygen -t rsa

 

 执行命令完成后,在window本地用户.ssh目录

 

 

(3)ssh密钥配置

    

     

右键记事本打开公钥

 

10.3 同步到远程仓库  

  两条命令:

  git remote add origin [email protected]:myyyplus/git_test.git

  git push -u origin master

 

 

 

 

  

   

 10.4 使用TortoiseGit同步

  

 10.4 使用TortoiseGit同步

Url,推送URL:远程仓库的地址

 

 (1)推送

 

 

 

 

 

 

10.5从远程仓库克隆

      

   

Guess you like

Origin www.cnblogs.com/qinzhenyu/p/12088037.html