Git 入门
git 安装
- Git 安装官网
 
git config --global user.name "yourname" git config --global user.email "[email protected]" git config --list (查看配置)
- sourceTree 安装官网
 
git 仓库
- 初始化版本库
 
git init ( 生成.git文件)
- 添加文件到版本库
 
git add git add --help (查看帮助文档 q 退出文档) git add -A (提交全部文件) git reset HEAD demo.txt (从仓库中移除) git checkout -- demo.txt (删除未提交变更) git commit git commit -m "commit info"
- 查看仓库状态
 
git status
Git 工作流
- 查看历史提交版本
 
git log
- 回退到某一版本
 
git reset --hard 2d62d28ea69a8ed0f69ae3daf0749c0382f2e197
- 删除某文件
 
git rm -f test.php
远程仓库
- 创建 SSH key 到github
 
ssh-keygen -t rsa -C "[email protected]" cat id_rsa.pub 复制公钥到github ssh -T [email protected] (判断是否设置成功)
- 添加远程仓库
 
git remote add origin [email protected]:youname/youproject.git (设置远程仓库) git pull origin master (拉取远程内容) git push -u origin master (推送到远程仓库)
克隆仓库
- 克隆仓库
 
git clone git地址
分支管理
- 创建分支
 
git branch feature/test1_branch (创建分支feature/test1_branch)
- 分支列表
 
git branch
- 切换分支
 
git checkout master (切换到master分支上)
- 删除分支
 
git branch -d feature/test1_branch (删除分支)
- 合并分支
 
git merge branch1
相关推荐
  baolen    2020-08-15  
   炼金术士lee    2020-08-15  
   huangchunxia    2020-08-07  
   lljhi0    2020-07-21  
   huangchunxia    2020-07-08  
   zhangxing    2020-07-05  
   ArkShen    2020-07-05  
   nebulali    2020-07-05  
   formula    2020-11-12  
   huhongfei    2020-11-05  
   乾坤一碼農    2020-10-27  
   liumengyanysu    2020-10-22  
   E哥的aws认证攻略    2020-10-15  
   tianyafengxin    2020-10-08  
   guying    2020-10-05  
   好脑筋不如烂笔头    2020-09-17