目录
使用IDEA进行push
这里我创建了一个简单的工程并添加了一个模块,测试push这个模块
![image-20200417142507722](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165806.png)
GitHub创建了一个新的远程库(今天发现的bug,如果push的文件和远程库已有的文件不一致,就不能视为更新版本)
Git的其他操作如clone、pull、解决冲突等操作在IDEA中都很可视化,很方便,这里我就不演示其他的操作了。
push的操作步骤:
1、IDEA(或其他环境)中登陆GitHub
![image-20200417140733787](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165807.png)
2、配置本地Git(一般会自动配置)
![image-20200417140915349](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165808.png)
3、在IDEA中创建Git本地库
有必要说明的是,IDEA虽然集成了Git,但是操作步骤还是和Git输入命令大同小异。
![image-20200417141850552](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165809.png)
选择我们需要push的工程(或模块)的路径,在这里选择创建Git本地库,git init
![image-20200417142046862](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165810.png)
到这里我们会发现,IDEA界面发生了某些变化
![image-20200417142325768](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165811.png)
4、初始化完成之后,就要将文件(模块)添加到暂存区,git add
add之后,如果文件绿了,就说明添加成功了
如果要修改这个模块,可以将它移出暂存区
![image-20200417143254902](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165814.png)
5、添加进暂存区之后,就该提交到本地库了,git commit
同Git命令行,如果想要push到本地库,必须要给一个message
![image-20200417144000184](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165816.png)
选择commit的话,模块就进入了本地库;当然也可以直接选择commit and push。
代码颜色会变正常,IDEA下方会出现一个新的工具栏,version control
![image-20200417144352075](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165817.png)
6、push到远程库
![image-20200417144527804](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165818.png)
编辑要推送到的远程库的信息
![image-20200417145729603](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165819.png)
选中push
![image-20200417145834127](https://raw.githubusercontent.com/kawendiyu/img_bed/master/img/20200417165820.png)