Idea本地项目上传到git远程仓库
1、 idea新建项目或打开要上传的项目
略
2、 新建项目远程仓库
3、 为项目创建本地仓库并上传git远程仓库
使用命令行:
项目根目录下点击鼠标右键Git Bash Here
git init
git add .
git commit -m "first commit"
git remote add origin https://git.e-nci.com/jeecg/treerecursion.git (添加远程仓库)
git push -u origin master
输入用户名/密码后上传成功
或使用idea 创建本地仓库,点击Git-add,commit,remotes,pull,push
git创建分支提交到远程分支步骤
1、 在本地新建分支
git branch newbranch
2、 把本地分支push到远程
git push origin newbranch
3、 切换到该分支
git checkout newbranch
4、 本地仓库newbranch分支关联远程仓库newbranch分支
git branch --set-upstream-to origin/newbranch newbranch
5、 查看本地修改
git status
6、更新
git pull
7、 添加本地修改
git add .
8、 commit修改
git commit -m 'XXXX'
9、 push代码
git push
本地仓库有文件,远程仓库也有文件,正确姿势:
1、git remote add origin 远程仓库地址
2、git pull origin master --allow-unrelated-histories
3、git branch --set-upstream-to=origin/master master
4、git push