版本控制软件-Git
git下载安装:
官网:https://git-scm.com/
下载地址:https://git-scm.com/download/win
基础配置信息:
查看配置列表 git config --list
设置用户名和邮箱地址
git config --global user.name "用户名"
git config --global user.email "邮箱地址"
基础命令
初始化仓库 git init
创建目录:mkdir aaa
创建文件:touch aaa
查看仓库状态 git status
文件添加到暂存区
git add 文件名
git add *.html 把指定的文件类型一次性全部提交
git add * 添加所有文件到暂存区
git add .添加所有文件到暂存区
提交文件创建版本
git commit -m '备注信息'
查看日志
git log //查看日志 git reflog //查看版本号
版本切换
切换到上一个版本 git reset --hard HEAD^
切换到上两个版本 git reset --hard HEAD^^
切换到上100个版本 git reset --hard HEAD~100
切换到指定版本号 git reset --hard 版本号
分支
master 主分支 可以对外发布和访问的程序
develop 开发分支 在主分支的基础上继续开发新功能
debug 调试bug
release 预发布分支
fixed 修复分支
…
查看分支:git branch
创建分支:git branch 分支名称
切换分支:git checkout 分支名称
合并分支:git merge 要合并的分支名称
删除分支:git branch -D 要删除的分支名称
结合GitHub共享仓库资源
在本地仓库添加远程仓库:
git remote add origin https://github.com/用户名/远程仓库名.git
推送资源到远程仓库
git push -u origin master
获取远程仓库资源
①克隆远程仓库到本地
git clone https://github.com/用户名/远程仓库名.git
一般只执行一次
②获取远程仓库资源
git pull