标签:信息 rem clone tor ranch 连接 its util etc
克隆现有的远程仓库到本地
[@wooluwakerdeMBP:gitLab]$ pwd /Users/walker/work/gitLab [@wooluwakerdeMBP:gitLab]$ git clone ssh://git@******.git #将远程仓库克隆到本地,会新创建wenjian目录 [@wooluwakerdeMBP:wenjian (master)]$ git remote -v #查看远程信息 origin ssh://git@******.git (fetch) origin ssh://git@******.git (push) [@wooluwakerdeMBP:gitLab]$ cd wenjian/ [@wooluwakerdeMBP:wenjian (master)]$ [@wooluwakerdeMBP:wenjian (master)]$ echo "2019年_******项目代码" >> REAMME.md [@wooluwakerdeMBP:wenjian (master)]$ git add . [@wooluwakerdeMBP:wenjian (master)]$ git commit -m‘添加项目说明‘ [@wooluwakerdeMBP:wenjian (master)]$ git push -u origin master #将本地master分支修改的代码提交到远程master分支,-u参数:加上一次之后,后续只需要git push 即可,不需要再加上 origin master Branch ‘master‘ set up to track remote branch ‘master‘ from ‘origin‘. # 在gitlab 的 web页面上可以看到最新的推送
将远程dev分支合并到远程master分支
git checkout -b dev origin/dev #在本地创建并切换到dev分支,并连接到远程的dev分支 [@wooluwalkerdeMacBook-Pro:wenjian (dev)]$ git pull origin dev [@wooluwalkerdeMacBook-Pro:wenjian (dev)]$ ll # 远程dev分支内容已经pull下来 total 16 drwxr-xr-x 10 walker staff 320B 2 2 12:59 . drwxr-xr-x 6 walker staff 192B 2 2 12:38 .. -rw-r--r-- 1 walker staff 6.0K 2 2 12:59 .DS_Store drwxr-xr-x 15 walker staff 480B 2 2 13:02 .git -rw-r--r-- 1 walker staff 0B 2 2 12:59 README.md -rw-r--r-- 1 walker staff 0B 2 2 12:59 __init__.py drwxr-xr-x 7 walker staff 224B 2 2 12:59 __pycache__ drwxr-xr-x 9 walker staff 288B 2 2 12:59 data drwxr-xr-x 6 walker staff 192B 2 2 12:59 merge drwxr-xr-x 8 walker staff 256B 2 2 12:59 utils [@wooluwalkerdeMacBook-Pro:wenjian (dev)]$ git checkout master Switched to branch ‘master‘ Your branch is up to date with ‘origin/master‘. [@wooluwalkerdeMacBook-Pro:wenjian (master)]$ ll # master分支并没有dev分支的内容 total 8 drwxr-xr-x 4 walker staff 128B 2 2 13:04 . drwxr-xr-x 6 walker staff 192B 2 2 12:38 .. drwxr-xr-x 15 walker staff 480B 2 2 13:04 .git -rw-r--r-- 1 walker staff 34B 2 2 13:04 README.md [@wooluwalkerdeMacBook-Pro:wenjian (master)]$ [@wooluwalkerdeMacBook-Pro:wenjian (master)]$ git merge dev #将本地dev分支合并到本地master分支 [@wooluwalkerdeMacBook-Pro:wenjian (master)]$ git status #本地master分支比远程master分支提前 On branch master Your branch is ahead of ‘origin/master‘ by 4 commits. (use "git push" to publish your local commits) [@wooluwalkerdeMacBook-Pro:wenjian (master)]$ git push # 将本地master分支推送到远程master分支
标签:信息 rem clone tor ranch 连接 its util etc
原文地址:https://www.cnblogs.com/wooluwalker/p/12251779.html