一、在Pycharm中配置集成Git
我们使用git需要先安装git工具,这里给出下载地址,下载后一路直接安装即可:
https://git-for-windows.github.io/
-
git中的一些常用词释义
Repository name: 仓库名称
Description(可选):仓库描述介绍
branches:分支
Public, Private : 仓库权限(公开共享,私有或指定合作者)
Initialize this repository with a README: 添加一个README.md
gitignore:不需要进行版本管理的仓库类型,对应生成文件.gitignore
license: 证书类型,对应生成文件LICENSE
1. 集成Gitlab
打开Pycharm, 点击File-->Settins-->Version Control-->Git 然后在 Path to Git executable中选择本地的git.exe路径。如下图:

配置git的安装路径

2. VCS中和git建立联系
菜单栏中VCS和GIT的交换呈现
在VCS的下拉菜单中,选择Get from Version Control

把Git版本库中的项目代码克隆到当前Pycharm的工作路径中。
进入1:点击Pycharm导航栏中的VCS -> Get from Version Control -> Git
进入2:点击Pycharm导航栏中的Git -> Clone
从本地Git版本库克隆项目

如果菜单栏中没有VCS,可以在设置-Version Control-Directory Mappings中进行设置;

3. 从版本库克隆项目
通过git,进入到magage remotes

配置git上的地址,
Name:origin
URL:http://git.xxxx/analysis/msq.git

4. 文件上传和提交


5. 通过文件名颜色识别文件状态。
红色, 表示在工作区
绿色, 表示在暂存区
蓝色, 表示文件有修改,位于暂存区
文件名无颜色,表示位于本地仓库区或已经提交到远程仓库区
6. 如何修改Git仓库中的文件?
修改和增加差不多,先修改文件,然后提交。
7. 如何删除Git仓库中的文件?
删除和增加差不多,先删除文件,然后提交。
8. 创建分支
在Pycharm右下角,我们可以看到Git:master,表示目前在主分支。可以点击Git:master新建分支,master主分支上保持最稳定代码的版本,然后每个小组一个分支,所以我要审查过每个分支上的代码再合并,而不是立刻将他们分支上的马上合并到master上面,一来保证了代码的质量,而来在小组方面可以更快发现bug,然后通知修改如下图所示:
