<meta charset="utf-8">
一、Git的下载和安装
Git下载地址:https://git-scm.com/download/win
选择自己合适的版本进行下载
下载之后选择路径,默认安装就好。
二、Git的使用
1、git的初始化
$ git init
$ git config --global user.name "[Your Name]"
$ git config --global user.email "[youremail@example.com]"
$ ssh-keygen -t rsa -C "[youremail@example.com]"

2、连接到远程服务器
$ git remote add origin [项目git地址]
3、检出项目分支到本地
该操作会在本地创建一个分支
$ git checkout -b [分支名]
4、拉取代码到本地
$ git pull origin [分支名]

5、查看本地文件状态

6、提交代码到本地仓库
$ git add [需要添加的文件名]

若需要添加所有的文件,则为
$ git add .

添加完成,查看本地文件状态

添加完成之后,进行提交到本地仓库
$ git commit-m"[提交日志]"

7、将本地代码推送到远程服务器
$ git push origin [分支名] //推送到某个分支
$ git pull --all //推送到所有分支

网友评论