作用
版本管理工具发展和历史
Git下载和安装
Git下载地址
https://github.com/git-for-windows/git/releases/download/v2.21.0.windows.1/Git-2.21.0-64-bit.exe
Source Tree下载地址
https://product-downloads.atlassian.com/software/sourcetree/windows/ga/SourceTreeSetup-3.1.2.exe
Git仓库
git init# 初始化版本库git add [文件名]git commit -m “描述信息”# 添加文件到版本库git status# 查看仓库状态
Git工作流
工作区-暂存区-版本库
回滚暂存区
git reset HEAD [文件名]# 丢弃暂存区git checkout -- [文件名]# 检查工作区文件
回滚仓库
git log# 查看commit记录,复制之前的commit IDgit reset --hard [commit ID]# 回滚到commit ID那个时候git diff [文件名]# 对比文件变化
远程仓库
创建ssh key
ssh-keygen -t rsa -C "email@example.com"cat /c/Users/win10/.ssh/id_rsa.pub# 然后上传pub到githubssh -T git@github.comgit remote add origin git@github.com:GitHubAaronXu/test.git# 添加远程仓库git push --set-upstream origin master# 同步本地仓库到远程git push# 推送本地仓库变化到远程
克隆仓库
git clone https://github.com/xtaci/kcptun.git
标签管理
| 命令 | 功能 |
|---|---|
| git tag | 查看所有标签 |
| git tag name | 创建标签 |
| git tag -a name -m “comment” | 指定提交信息 |
| git tag -d name | 删除标签 |
| git push origin name | 标签发布 |
分支管理
git branch [分支名]# 创建分支git branch# 查看分支git checkout [分支名]# 切换分支git merge [分支名]# 在主线上合并分支git branch -d [分支名]# 删除分支
Hexo
node.js下载
https://nodejs.org/dist/v10.15.3/node-v10.15.3-x64.msi
使用国内镜像源
npm config set registry https://registry.npm.taobao.orgnpm config get registry# 验证是否成功
开始安装
npm install hexo-cli -g # 安装hexohexo -v # 检查版本hexo init # 初始化文件夹npm install # 安装所需组件hexo generate # 在本地生成静态文件hexo server # 启动本地服务
修改 _config.yml
deploy:type: gitrepo: https://github.com/YourgithubName/YourgithubName.github.io.gitbranch: master
npm install hexo-deployer-git --save # 安装部署到git的工具hexo cleanhexo generatehexo deploy
