git 安装
git config --global user.name "yourname"
git config --global user.email "youremail@163.com"
git config --list (查看配置)
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-keygen -t rsa -C "youremai@email.com"
cat id_rsa.pub
复制公钥到github
ssh -T git@github.com (判断是否设置成功)
git remote add origin git@github.com: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