git使用步骤
1报名出处:
git config --global user.name lhp 用户名
git config --global user.email a@.qq.com 邮箱
2.建立项目文件夹:mkdir test
3.建立版本库:git init
4.命令操作:
查看版本状态:git status
如果新建了文件:使用 git add a.php
添加当前目录所有变化:git add .
提交版本:git commit -m "备注" a.php
修改:git commit -am "备注" (a代表修改所有的文件)
添加所有的改变:git add -A
删除文件:git rm a.php
克隆 (ssh方式)
git clone git@git.oschina.net:......
拉取远程仓库代码(https方式)
git pull https://git.oschina.net master
添加远程版本库到本地(https方式)
git remote add origin https://git.oschina.net/
提交到远程版本库
git push origin master
忽略:
在根目录生成 .gitignore
然后在里面加上忽略的文件或目录:如 /runtime a.txt等
更新线上最新版本:
git pull origin master
提交最新版本:
git push origin master
小绵羊