gitlab常用功能

git解决 fatal: unable to connect to github.com
原因:
需要用https才能读到数据
解决方法:输入命令
git config --global url."https://".insteadOf git://


git命令执行git clone提示“fatal: unable to access目标地址”的问题
当执行git clone https://github.com/burnszp/guns-lite.git 命令的时候,一直提示无法访问
解决方法:把https改成git即可


git SSL certificate problem: unable to get local issuer certificate
解决方法:
git config --global http.sslVerify false


解决 fatal: Not a git repository (or any of the parent directories): .git 问题
解决方法:
git init


gitlab切换分支
1) 把项目下载到本地 git clone https://(改成完整url)
2) 切换到文件目录下,git branch -a,查看是否存在分支
3) 切换到你想要到的分支
git checkout 分支名
4) 检查是否切换成功,查看当前分支
git branch


切换到D盘
cd d:
进入目录
cd ./saturn/saturn
切换分支
git checkout luochengang


把本地项目上传至gitlab
git pull origin luochengang --allow-unrelated-histories
git commit -am "description"
-a 表示 add
commit前需要git add
git push -u origin luochengang         //第一次push加上-u参数,以后就可以直接使用git push origin luochengang
提交代码流程:
首先pull,然后add,然后commit,最后push


git报错:'fatal:remote origin already exists'
1) 先删除
git remote rm origin


.gitkeep的作用是为了提交空文件夹

撤销“修改并git commit,并且发送到了gitlab”的文件
1) git log查看提交历史记录
我们通过git log可以看到上一次提交的id为e1aa8a5771abee379236b0825e2140c0955bec35,我们使用git revert命令撤销提交(也可以用HEAD代替本次ID)
2) git revert HEAD
3) git log查看提交历史记录


git add总结:
git add -A 提交所有变化
git add -u 提交被修改(modified)和被删除(deleted)文件,不包括新文件(new)
git add . 提交新文件(new)和被修改(modified)文件,不包括被删除(deleted)文件


常用模板:
1) git pull origin luochengang --allow-unrelated-histories
2) git add -A (可以按照需要改成相应的add指令)
3) git commit -m "description"
4) git push origin luochengang

你可能感兴趣的:(研究)