Git bash Application Practice 1: Basic Usage

Foreword

Git basic usage of this study, from scratch operation code repository on github, complete ssh provisioning, cloning, push, update, delete local tasks such as remote branch.

I. Introduction

1.Git Profile

Git is an open source version of "Linux father" Linus Torvalds To help manage Linux kernel development and the development of control software, you can easily manage multiple participants the same code repository, but Git is a distributed version control system, compared with CVS, SVN and other centralized version control system, more security, because everyone has a complete computer repository, a personal computer is broken does not matter, just a copy on it from others.

Briefly, Git has the following advantages:

(1) for distributed development, emphasis on the individual.
(2) the amount of public pressure on the server and the data will not be too large.
(3) fast and flexible.
(4) can easily resolve any conflict between two developers.
(5) working offline

2.Git Download

Download Link: https://git-scm.com/downloads

Second, the basic usage

1. Local generation SSH

SSH Key allows you to encrypt computer and server to establish a secure connection

(1) generating ssh command
ssh-keygen -t rsa -C "[email protected] "

This command will ask you to provide a file name and location to store key-value pairs and password, you can press Enter to use the default.

(2) windows copied into the clipboard
clip <~ / .ssh / id_rsa.pub

2. Add the ssh to the cloud

Enter Github Setting column, click on the New SSH key, since the contents copied, pasted into the Key edit box, Title can be customized.
ssh

3. Create a cloud project test

create_rep
Note Check the Initialize this repository with a README

4.从云端克隆一个项目

git clone [email protected]:solitary-sand/test.git
Git bash Application Practice 1: Basic Usage

本地下载文件如下:
Git bash Application Practice 1: Basic Usage

5.本地代码推送到远端

(1)保存本地的修改到暂存区
保存所有修改:git add .
将<path>添加到索引库:git add <path>

(2)编写commit信息
git commit -m "需要更新到云端的commit信息"

(3)推送
git push (第一次push需要使用git push -u origin master)

(4)具体操作

我们修改readme.md,增加一句话please open readme.md first,如下所示:
modify

输入命令:
gitadd .
git commit -m"modify README.md"
git push -u origin master
push

云端显示内容如下:
show_modify

6.拉取远端代码

git pull

7.创建一个新的分支并提交到远端

(1)本地切换分支
git checkout -b dev
checkout_dev

(2)推送到远端
git push origin dev
push_dev

(3)查看云端
Git bash Application Practice 1: Basic Usage

8.本地删除远端分支

(1)先切换到其他分支
git checkout master
checkout_master

(2)删除本地要删除的分支
git branch -d dev
del_local

(3)删除远端分支
git push origin --delete dev
del_remote

(4)查看云端
show_del_cloud

三、结语

1.总结:

End of this section, the actual operation needs attention are the following:

(1) ssh configuration

Ssh locally generated when the general saved in C: \ Users \ Administrator.ssh path.
ssh_jieyu

2. Postscript:

If you have any questions in the course of further exchanges please add QQ group.

QQ exchange group: 906 015 840 (NOTE: Internet of Things project communication)

Leaf lone sand Publisher: one grain of sand in the world, a Bodhi leaf

WeChat

Guess you like

Origin blog.51cto.com/14616151/2452662
Recommended