创建仓库
git clone http://*.git
git init
git remote add origin https://*.git //添加远程仓库
git pull origin master --allow-unrelated-histories //与远程仓库关联
修改配置
编辑.git/config文件
[user]
name = 七月编程
email = 七月编程@126.com
[remote "origin"]
url = https://github.com/july/july.git
git config user.name 潮哥笔记
新增文件并提交至远程仓库
git add .
git commit -m ‘’
git push
创建分支
git branch 分支名称
git checkout 分支名称 //切换分支
git checkout -b 分支名称
git branch -a //查看所有分支
合并分支
git merge 分支名称 //合并分支到当前分支
文件暂存/恢复
git commit提交文件,服务器返回本地文件有修改。
1、git stash :暂存本地代码
2、git pull origin develop : 获取远程分支代码
3、git stash pop:恢复之前暂存的文件
tag标记
git tag -a v1.1 -m ‘嗯’
git push --tags //推送tag到远程仓库
回退版本
1、找到你误提交之前的版本号
2、git revert -n 版本号
3、git commit -m xxxx 提交
4、git push 推送到远程
参考:https://www.cnblogs.com/aligege/p/10221174.html
常用命令
https://blog.youkuaiyun.com/hualusiyu/article/details/78319126?utm_source=app&app_version=4.5.2