Git Quick Start

Git is an open source distributed version control system for handling any project, small or large, with agility and efficiency. Git is an open source version control software developed by Linus Torvalds to help manage Linux kernel development. Git is different from the commonly used version control tools CVS, Subversion, etc. It adopts a distributed version library method without server-side software support.

Git download

Download the latest version of Git directly from https://git-scm.com/downloads , and install it by default.

After the installation is complete, find Git->Git Bash in the start menu. After clicking, a command line window will appear, which means that the Git installation is successful.

Git configuration

Configure the account and mailbox of the local warehouse in the command line

$ git config --global user.name "wupeixuan"  
$ git config --global user.email "[email protected]"  

To avoid entering a password for each remote access, use ssh to log in. ssh is bound to local information, so each computer needs to be generated separately.

$ ssh-keygen -t rsa -C "[email protected]"  

ssh is only local now and needs to be backed up in GitLab in order to be verified. Open your own GitLab, in My Profile, click Add Public Key, the title is optional.

The content of the key is in the local C drive, C:\Users\wpx.ssh (under your account), there is a .ssh folder in it, open id_rsa.pub with a text file, and copy all the content to the key in, you can;

At this point, the basic configuration is completed; we need to obtain the address of the project on GitLab, each project address is different, generally in the Projects of GitLab, you can find all the projects related to you, click on a project, you can see the project address, Then in Git Bash enter:

$ git clone [email protected]:grampus/grampus-replenishment.git

Synchronize the data to the local, after the general association, directly:

$ git pull  

To complete the pull of the project

So far, we have completed the process of a project on GitLab to the local.

Git common commands

#查看分支
$ git branch
#创建分支
$ git branch f_20180428_orderMigration
#切换分支
$ git checkout f_20180428_orderMigration
#创建+切换分支
$ git checkout -b f_20180428_orderMigration
#合并某分支到当前分支
$ git merge f_20180428_orderMigration
#删除分支
$ git branch -d f_20180428_orderMigration
#查看变更历史
$ git log

Unified git branch naming convention

feature功能分支命名规范:f_时间戳_功能,注意下划线不是中线-
正确实例:
f_20180326_orderMigration
fixbug bug修复分支命名规范:
x_时间戳_功能
正确实例:
x_20180326_orderMigration

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325088220&siteId=291194637