git idea 初始化项目

一、新建码云项目

二、idea新建项目

1.项目根下新建新建README.MD 和.gitignore

.gitignore忽略提交文件

*.class

#package file

*.war
*.ear

#kdiff3 ignore
*.orig

#maven ignore
target/

#eclipse ignore
.settings/
.project
.classpathch

#idea
.idea/
/idea/
*.ipr
*.iml
*.iws

# temp file

*.log
*.cache
*.diff
*.patch
*.tmp

#system ignore
.DS_Store
Thumb.db
2.点idea 下方的Terminal

git init

3.git status 查看git状态,git add .添加新增修改的文件


4.再git status 查看添加的文件


5.git commit -am "first commit init project" 提交修改的文件到本地库


6.把项目push到远程仓库
git remote add origin https://gitee.com/xxx.git


7.查看分支git branch


第一次推送报错
推送远程git push -u origin master
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://gitee.com/liziming/mmail.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


错误解决:先执行git pull


再执行:提示当前分支落后远程版本
git push -u origin master
To https://gitee.com/liziming/mmail.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://gitee.com/liziming/mmail.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.


8.强制推送 git push -u -f  origin master


9.git branch 查看本地分支 git branch -r 查看远程分支


10.新建远程分支,从主分支中新建v1.0分支
git checkout -b v1.0 origin/master
Branch v1.0 set up to track remote branch master from origin.
Switched to a new branch 'v1.0'


提示本已经切换到v1.0分支


11.把分支推送到远程git push origin HEAD -u

三:修改提交代码
1.git status 查看本地 修改状态
2.git add . 添加修改的文件 git status
3.git commit -am 'modify commit' -a 提交 m 提交说明
4.提交远程 git push 
查看分支 git branch


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值