git常用操作
git日常推送操作
git add .
git commit --no-verify -m "XXX"
git push --no-verify
--no-verify:不校验错误
问题:每次拉代码都提示密码登录
- https://www.cnblogs.com/zshno1/p/11282348.html
- token登录:git官网usersetting->access Tokens,生成新密码登录
git分支操作:
查看分支: git branch -a
更新远程分支:git fetch origin <远程分支名>
切换分支:git checkout -b <本地分支名> origin/<远程分支名>
删除分支:git branch -d(D)
回滚:git log -3
git reset --hard commit_id(版本号)
git push -f origin master (强制提交)
回滚特定文件:https://blog.csdn.net/fsgsggd/article/details/79875035
分支管理:http://www.ruanyifeng.com/blog/2012/07/git.html
# 切换到Master分支
git checkout master
# 对Develop分支进行合并
git merge --no-ff develop
这里稍微解释一下,上一条命令的--no-ff参数是什么意思。
默认情况下,Git执行"快进式合并"(fast-farward merge),会直接将Master分支指向Develop分支。
使用--no-ff参数后,会执行正常合并,在Master分支上生成一个新节点。
一、主分支Master :代码的正式版
二、开发分支Develop:正在开发的最新版代码
三、临时性分支:处理完后删除
* 功能(feature)分支
* 预发布(release)分支
* 修补bug(fixbug)分支
git配置代理:
参考链接:https://www.cnblogs.com/mymelody/p/6132728.html
公司内网 git 访问外网需要设置代理,而一般网上给出的设置方法是 git config --global http.proxy ***.***.**.**:8080。
局部配置,只在当前项目目录下配置代理
1.局部配置:git config --local http.proxy 10.***.***.***:****(域名:端口),git clone时需要配置全局,之后可切换为局部配置
2.全局配置:git config --global http.proxy 10.***.***.***:****(域名:端口)
3.查看:git config --get --global http.proxy
4.取消:git config --global --unset http.proxy
ERROR:
在使用git推送项目时候出现 "fatal: The remote end hung up unexpectedly " 原因是推送的文件太大
在Git的config文件内添加,设置本地缓存大小
[http]
postBuffer = 524288000
ERROR:
vscode 删除文件后,点击merage后没有自动合并,报错:
You have not concluded your merge (MERGE_HEAD exists).
Please, commit your changes before you can merge.
1.保留你本地的修改
git merge --abort
git reset --merge
git pull //
合并后记得一定要提交这个本地的合并,然后在获取线上仓库