Git简明教程
参考资料
个人项目的版本控制流
- 下载安装git,进行user.name和user.email的配置
1 | git config --global user.name "Your Name" |
- 完成ssh密钥配置
1 | ssh-keygen -t rsa -C "planckgh@gmail.com" |
- 在本地工作目录新建git版本管理库
1 | git init |
- 新建工作文件(
test.c
)
1 | vim test.c |
- 添加改动文件至暂存区
1 | # 单个文件 |
- 完成阶段性工作后,提交至HEAD
1 | # 无改动提交 |
- 创建分支&跳转分支
1 | # 创建分支 |
- 查看版本提交记录
1 | git log |
- 回溯版本
1 | git reset --hard 版本号 |
- 查看回溯历史
1 | git reflog |
- 推送至远程仓库
- 在github上创建新仓库,获取仓库链接
- 将本地仓库与远程仓库进行关联
1
git remote add origin https://github.com/planckzgh/ROIC.git
- 将本地仓库推送至远程仓库
1
git push (-u) origin master
- 修改本地仓库关联链接
1
git remote set-url origin https://github.com/planckzgh/ROIC.git
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 planckgh!