一、git官网
http://git-scm.com
二、查看git安装路径
which git
三、 配置config
git config --global user.name "jihaichuan"
git config --global user.email "jihaichuan@126.com"
四、初始化git
git init
五、添加所有的本地文件
git add .
六、 提交文件
git commit -m 'install laravel'
七、 删除缓存区的编辑器自带的文件夹 .idea目录
git rm -r --cached .idea/
八、 新增 “add-web-page” 分支
git branch add-web-page #新增分支
九、 查看所有分支
git branch
十、 切换 add-web-page 分支
git checkout add-web-page
git checkout -b add-web-page #新增分支并直接切换到该分支
十一、 合并 add-web-page 分支, 首先需要切回到 master 分支上面
git marge add-web-page
十二、 删除 add-web-page 分支
git branch -d add-web-page
十三、 配置git快捷命令
git config --global alias.s status
git s #相当于 git status
十四、 删除配置的git快捷命令
git config --global --unset alias.s
十五、 把已有的项目推送到github上面
git remote add origin https://github.com/jihaichuan/xiaocx.org.git
git push -u origin master
十六、把本地项目push到 github 上面
git push
十七、 查看git日志,图像化
git log --graph
十八、 在服务器上面git pull时不需要重复的输入账号和密码,编辑vim .git/confg在底部新增
[credential]
helper = store
十九、 更新服务器代码
git pull
git pull origin master
二十、 查看版本直接的不同
git diff
二十一、 恢复到上传提交的版本
git reset --hard 32323432
二十二、 生成ssh秘钥
ssh-keygen
cat ~/.ssh/id_rsa
cat ~/.ssh/id_rsa_pub
二十三、 查看git提交的远程地址
git remote -v