此处使用的远程仓库是GitLab,使用git bash命令行进行操作
1. 初始化本地仓库并上传到远程
1)在本地创建一个空文件夹,用git bash进入到这个目录下,
$ git init

2)这步完成后就会在文件夹下出现 .git文件夹

3)在这个文件夹下用as新建工程

4)工程新建完毕后,将远程仓库与本地仓库关联
$ git remote add origin git@172.17.193.106:meisijia/GitDemo.git

5)将刚刚用as新建的项目上传到远程 (add - commit-push)


最终仓库中就出现了工程目录:

2. 删除远程仓库的某个文件夹(如误上传的.idea文件夹)
以.idea文件夹为例:
git rm -r -n --cached ".idea/" //-n:加上这个参数,执行命令时,是不会删除任何文件,而是展示此命令要删除的文件列表预览。
git rm -r --cached ".idea/" //最终执行命令.
git commit -m" remove .idea folder all file out of control" //提交
git push origin master //提交到远程服务器


3.分支合并
1.先切换到master主分支上

2.进行快速合并
git merge dev

参考文章:
1.Git实现从本地添加项目到远程仓库
网友评论