#一、新建项目
1、新建Maven项目
![](https://img.haomeiwen.com/i4631695/91bf04827903a647.png)
2、填写相关参数 接着下一步就行
![](https://img.haomeiwen.com/i4631695/158935cf5dd834ad.png)
3、博主发现在新建玩Maven项目时候少了一些文件夹,
比如resource
于是采用下面步骤新建
![](https://img.haomeiwen.com/i4631695/f46015c6171490cf.png)
点击 Project Structure...
![](https://img.haomeiwen.com/i4631695/cc159f1e76964191.png)
点击左侧Modules
然后在main上面新建resource
文件夹并且设置为Resources
![](https://img.haomeiwen.com/i4631695/b36659876dc48658.png)
然后在文件夹下直接新建比如java 、test
等文件夹就行。
4、配置Tomcat运行项目
![](https://img.haomeiwen.com/i4631695/685427e461e2db2d.png)
点击Run
接着点击Edit Configurations...
![](https://img.haomeiwen.com/i4631695/122c13700ddc4641.png)
![](https://img.haomeiwen.com/i4631695/3d1d85bb57211635.png)
![](https://img.haomeiwen.com/i4631695/fc56184c641d101a.png)
![](https://img.haomeiwen.com/i4631695/355fddacc6e222e4.png)
![](https://img.haomeiwen.com/i4631695/41006fbd892c90bd.png)
二、将项目提交到码云
在码云创建好一个仓库
1、打开IDEA的Terminal
窗口,先创建这两个文件 README.md
.gitignore
使用以下命令
cd.>README.md
cd.>.gitignore
文件作用:
README.md
:对项目的描述,
.gitignore
:设置git提交代码的时候忽略哪些文件
.gitignore
中可填写以下内容
*.class
#package file
*.war
*.ear
#kdiff3 ignore
*.orig
#maven ignore
target/
#eclipse ignore
.settings/
.project
.classpath
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
# temp file
*.log
*cache
*.diff
*.path
*.tmp
#system ignore
.DS_Store
Thumbs.db
2、执行 git init
初始化
git status
git add .
git commit -am "First commit"
设置路由:
git remote add origin https://gitee.com/Chakid/mmall_learning.git
查看当前分支:
git branch
先将项目pull
下来
git pull
由于是第一次提交,我们添加-f
参数,强制提交,将码云中的直接覆盖。
git push -u -f origin master
git branch -r
![](https://img.haomeiwen.com/i4631695/fc300600c95ebfde.png)
[分支开发,主干发布]
创建一个新分支,叫v1.0
,并且将master里面的内容复制到v1.0
:
git checkout -b v1.0 origin/master
将分支推送到远程(码云)
git push origin HEAD -u
![](https://img.haomeiwen.com/i4631695/612f5606526c7473.png)
![](https://img.haomeiwen.com/i4631695/ae25d17972adf473.png)
![](https://img.haomeiwen.com/i4631695/3757dded8a8b1304.png)
网友评论