git命令
git config --global user.name "wb-yjx804283"
git config --global user.password "***"
git config --global user.email "wb-yjx804283@alibaba-inc.com"
在github账号下为项目创建远程仓库
在项目同级目录执行下列命令:
git remote add origin https://github.com/JaxYoun/FontServer.git
git init //创建本地git仓库
git status //查看当前仓库托管状态(哪些被托管)
git add ./demo/ //将工作区中的demo工程给Git托管
git commit -m "提交注释" //将工作区提交到本地仓库
git remote add origin https://github.com/JaxYoun/FontServer.git //将本地仓库与远程仓库同步
git push -u origin master //推送到远程仓库
-------------------------------------------------------------------
…or create a new repository on the command line
echo "# SpringBootDubbo" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/JaxYoun/SpringBootDubbo.git
git push -u origin master
-------------------------------------------------------------------
…or push an existing repository from the command line
git remote add origin https://github.com/JaxYoun/SpringBootDubbo.git
git push -u origin master
-------------------------------------------------------------------
git commit -m "yang first commit!" //将内容提交到本地仓库本地
git push -u origin master //向新仓库首次提交主分支,其中“master”是分支名
D:\myTest>git clone http://10.0.0.171/cloud/cloud.git //从远程仓库克隆整个项目到本地仓库目录
git branch yjx //新建非跟踪分支yjx(不与远程分支同步)
D:\myTest\cloud>git branch [branchName] --track origin/alpha //新建与远程alpha分支对应的本地跟踪分支alpha(会同步)
D:\myTest\cloud>git checkout --track origin/alpha //新建与远程alpha分支对应的本地跟踪分支alpha(会同步)并切换
git branch //查看当前操作的分支
git checkout yjx //切换到yjx分支
git push origin newBranch //将新分支发布到远程仓库
git status //查看当前分支上的文件状态
git add . //将修改添加到stage
git commit -m 'xxxxx' //将修改提交到当前分支对应的本地分支上
git checkout alpha //切换到本地alpha分支
git branch
git merge yjx //将本地yjx分支,合并到本地alpha分支
git status
git fetch origin alpha //拉取远端alpha分支(FETCH_HEAD)
git merge FETCH_HEAD //将远端alpha分支合并到本地alpha
//解决冲突
git add .
git commit -m 'yyyyy'
git status
git push origin alpha
/********************************************/
git remote add origin git@github.com:JaxYoun/ActiveMqDemo.git //将项目添加到远程仓库
从GitHub克隆项目到本地
1.到GitHub远程仓库打开对应项目,点击"clone or download"按钮,选择通信协议HTTPS或者SSH【一个不能clone,切换试试】
2.复制框中的链接https://github.com/JaxYoun/spring-boot-redis-session-demo.git
3.在本地目录中【不需要新建与项目同名的目录】打开GitBash,输入git clone https://github.com/JaxYoun/spring-boot-redis-session-demo.git
4.等待下载完成
学习使我充实,分享给我快乐!