Git and Github presentation, simple operation

purpose:

     1.git and github Profile

      2. Git and SVN difference

    3. Github simple to use

    4. download and install Git-20-64-bit.exe

     5.Git commonly used commands

      5.1 Git command usage scenarios

      5.2 Common Commands

     5.3 Practice: Use git submit files to a remote repository


Introduction to Git and Github

  Introduction to Git: Git is an open source [ distributed ] [ version control system ] , for quick and efficient handling of any small or large projects 

 Version of the controller:

    CVS/SVN/Git

 SVN:

    Client / server

   GIT:

       Client / code hosting site ( for example: GitHub)

 Note 1 : The site also hosted similar code: GitHub / yard cloud / cloud Ali Code Source Management

  Note 2 : similar technology gitlab , but it GitHub there are some differences

   GitLab and GitHub as belonging to third parties based on Git development work, free and open source. And Github Similarly, users can register, submit any of your code, add SSHKey and so on.

   The difference is, gitlab can be deployed on its own server, database and other information are all in their own hands, for internal team collaborative development,

   You can not always put wisdom within the team always on someone else's server, right? In simple terms it can be put GitLab seen as a personal version of GitHub .

Github profile:

  GitHub is an open source code hosting platform, using GitHub can view other people's projects, you can create static pages, you can manage plug-ins, you can compile online, and so on can be managed code.


Git and SVN difference

 1, to the center

      GIT is distributed, SVN is not: This is the GIT and other non-distributed version control systems such as SVN , CVS , etc., the core difference.     

 2, git any one copy of the repository can be used independently as a server

 3, in the Git file There are four states:

      No trace (untrack) : Indicates the file is newly added

      Modified (Modified) : represents the modified file, but have not yet saved to the git repository.

      Has been staging (staged) : representation of a modified version of the current file been marked to include a snapshot of the next submission

      Has been submitted (committed) : indicates that the file has been saved in the git repository.

  4, other

      GIT is not a global version number, and SVN are: So far it is with SVN compared to GIT biggest missing a feature.

      GIT content integrity is superior to SVN : GIT content storage using the SHA-1 hash algorithm. This ensures the integrity of the source content, ensuring reduced repository in the event of disk failure and damage to network problems

  5, recorded directly snapshots, rather than differences

      GIT contents by metadata stored, and SVN is by file: All resource control systems are the meta-information files hidden in a similar .svn, .cvs other folder.

Snapshots recorded directly, rather than differences

  6, direct recording snapshots, rather than differences

      GIT branches and SVN different branches, a branch in SVN that is not in particular, is another of a directory in the repository.

        


Simple use of Github

   Create a public library test224_pub

   Here Google browser can automatically translated into Chinese

  

  

  Creating a private warehouse text224

  

success:

Create a folder

  

Creating success

 

Delete warehouse

 

 

 


Download and install Git-20-64-bit.exe

  download link:

https://git-scm.com/downloads

  There are bloggers downloaded installation package:

Links: https://pan.baidu.com/s/1vbEbN1X7oHYbOM29nO-r0A extraction code: jkbr

 Click Next> to select the folder you want to install directory

 Creating Start Menu directory name, the default git , no need to modify

 Select git Editor of

 

 

 

 End of the line conversion line break, use the default values

 

 installation

Detecting the installation is successful, any window or the desktop can be right, can occur following two options

 

 

 

 


 

 Git commonly used commands

  Click Git bash here to open a command window

  Check the configuration list git

git config --list 

  Set the user name / email / password

git config --global user.name "username" --双引号中的自己

 git config --global user.email "email"

 git config --global user.password "password"

Git命令使用场景

  git文件状态与工作区域

 

git的文件状态是其git核心内容,了解后对后续的操作有莫大的帮助,不同的文件状态又存储在不同的工作区域中。

 

  1.文件状态 

  未跟踪(untrack):表示文件为新增加的

 

  已修改(modified):表示修改了文件,但还没保存到git仓库中。

 

       已暂存(staged):表示对一个已修改文件的当前版本做了标记,使之包含在下次提交的快照中

 

       已提交(committed):表示文件已保存在git仓库中。

 

   2.工作区域

 

     2.1本地计算机

 

     Working Directory(工作目录):即正在编辑的文件状态。文件状态为未跟踪(untrack)和已修改(modified)在此区域内。

 

     Staging Area(暂存区):保存了下次将提交的文件列表信息。文件状态为已暂存(staged)在此区域内。

 

     Repository(本地仓库):提交到本地仓库的文件。

 

     2.2远程计算机

 

     Repository(远程仓库):已提交到远程计算机内的文件。

 

 

 

常用命令

 git clone :将远程仓库clone到本地计算机。

   git status :展示工作区及暂存区域中不同状态的文件。

   git add :将内容从工作目录添加到暂存区。

   git commit :所有通过 git add 暂存的文件提交到本地仓库。

   git push :将本地仓库的记录提交到远程仓库。

   git reset HEAD <file> :从暂存区移除指定文件。

   git checkout -- <file> :从本地仓库恢复指定文件。

   git pull :拉取远程仓库的数据。

   git init

实践操作:使用git提交文件至远程仓库

  

Guess you like

Origin www.cnblogs.com/huangting/p/11684508.html