商城项目一、项目初始化




1.创建java文件夹
test->java文件夹
创建README.md文件 和.gitignore文件
2.编辑.gitignore文件 内容如下
*.class
#package file
*.war
*.ear
#kdiff3 ignore
*.orig
#maven ignore
target/
#eclipse ignore
.settings/
.project
.classpatch
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
#temp file
*.log
*.cache
*.diff
*.patch
*.tmp
# system ignore
.DS_Store
Thumbs.db
以上文件不会提交到git远程仓库
3.编辑好之后执行命令 git init
出现
Initialized empty Git repository in E:/zhengchengProjects/mmall/.git/
4.执行 git status
On branch masterInitial commitUntracked files: (use "git add..." to include in what will be committed)
.gitignore
README.md
pom.xml
src/
nothing added to commit but untracked files present (use "git add" to track)
5.执行git add .
git status
On branch masterInitial commitChanges to be committed: (use "git rm --cached..." to unstage)
new file: .gitignore
new file: README.md
new file: pom.xml
new file: src/main/webapp/WEB-INF/web.xml
new file: src/main/webapp/index.jsp
6.执行git commit -am "first commit init project"
[master (root-commit) 068ae3e] first commit init project
5 files changed, 70 insertions(+)
create mode 100644 .gitignore
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/webapp/WEB-INF/web.xml
create mode 100644 src/main/webapp/index.jsp
7.将本地仓库提交到远程仓库 执行
git remote add origin https://gitee.com/journeyIT/mmall.git
8.查看分支
git branch
9.从远程仓库中pull拉取
git pull
10.执行推送
git push -u origin master
报错
To https://gitee.com/journeyIT/mmall.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/journeyIT/mmall.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
落后于远程仓库分支
11.强制推送
git push -u -f origin master
12.查看分支
git branch -r
13.在master上生成v1.0的新分支
git checkout -b v1.0 origin/master
14.查看当前分支
git branch
15.将当前分支推送到master
git push origin HEAD -u
16.pom文件
search.maven.org
略

浙公网安备 33010602011771号