Git常用命令与常见问题解决
Git
廖雪峰Git教程
- 版本回退
- git commit
- git log
- git reset --hard HEAD^
- git reset --hard 1094a(commit id)
- git reflog
- 远程仓库
- git pull gitee master
- git push gitee master
- 本地仓库
- git add
- git add .
- git commit -m
- git status
- git checkout -- file
- 分支
- git checkout -b branchName
- git branch
- git merge branchName
- git branch -d branchName
- git switch branchName(新)
- git switch -c
- master 稳定
- dev 开发
- git merge --no-ff -m "" branchName
git ssh 密码忘记怎么办?
- ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
- [原帖](https://blog.csdn.net/qq_34902522/article/details/78498664)
Git使用代理
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080
查看http、https代理配置情况
git config --global --get http.proxy
git config --global --get https.proxy
取消
git config --global --unset http.proxy
git config --global --unset https.proxy
.gitignore文件
1、当然如果已经push了怎么办?当然也有解决方法,如下:
有时候在项目开发过程中,突然心血来潮想把某些目录或文件加入忽略规则,按照上述方法定义后发现并未生效,原因是.gitignore只能忽略那些原来没有被track的文件,如果某些文件已经被纳入了版本管理中,则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除(改变成未track状态),然后再提交:
git rm -r --cached .
git add .
git commit -m 'update .gitignore'
作者:多光束叠加的梦
链接:https://www.jianshu.com/p/f77be6eb643f
来源:简书
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。