1、进入项目所在的文件夹
cd /Users/simon/Documents/workspace/wp_201804/elastic-job-springboot-starter
执行:git init
把这个文件夹变成Git可管理的仓库
结果:
Initialized empty Git repository in /Users/simon/Documents/workspace/wp_201804/elastic-job-springboot-starter/.git/
此时,项目根路径下,会多出一个.git 隐藏文件夹,它是Git用来跟踪和管理版本库的.
执行:git status
可以看见所有文件
.gitignore
.mvn/
mvnw
mvnw.cmd
pom.xml
src/
2、执行:git add .(add 和.之间隔开)
查看状态:git status
new file: .gitignore
new file: .mvn/wrapper/maven-wrapper.jar
new file: .mvn/wrapper/maven-wrapper.properties
new file: mvnw
new file: mvnw.cmd
new file: pom.xml
new file: src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/ElasticJobSpringbootStarterApplication.java
new file: src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/config/MySimpleJob.java
new file: src/main/java/com/foxiaotao/test/elasticjobspringbootstarter/controller/HomeController.java
new file: src/main/resources/application.yml
new file: src/main/resources/home.html
new file: src/test/java/com/foxiaotao/test/elasticjobspringbootstarter/ElasticJobSpringbootStarterApplicationTests.java
3、提交,执行
git commit -m "add resource to remote repository"
4、在自己github建立一个项目
复制新建git的地址:https://github.com/foxiaotao/elastic-job-springboot.git
5、建立git client 端和githut的ssh
6、把代码提交到remote ( 注意吧git地址换成你们自己的项目 )
git remote add origin https://github.com/foxiaotao/elastic-job-springboot.git
git push -u origin master
7、推荐使用工具sourceTree