Git/仓库:修订间差异
来自康健生活
创建页面,内容为“== 提交至多仓库地址 == 查看远端仓库信息 {{shc|<syntaxhighlight lang="bash"> git remote -V</syntaxhighlight>|$|/home/kangkk}} 添加远程仓库地址 {{shc|<syntaxhighlight lang="bash"> git remote add orgin git@git.abc.xyz/xxx/xx.git </syntaxhighlight>|$|/home/kangkk}} 绑定多个远端仓库 {{shc|<syntaxhighlight lang="bash"> git remote set-url --add origin git@git.dce.xyz/xxx/xx.git</syntaxhighlight>|$|/home/kangkk}}” |
无编辑摘要 |
||
| (未显示同一用户的1个中间版本) | |||
| 第13行: | 第13行: | ||
{{shc|<syntaxhighlight lang="bash"> | {{shc|<syntaxhighlight lang="bash"> | ||
git remote set-url --add origin git@git.dce.xyz/xxx/xx.git</syntaxhighlight>|$|/home/kangkk}} | git remote set-url --add origin git@git.dce.xyz/xxx/xx.git</syntaxhighlight>|$|/home/kangkk}} | ||
=== remote === | |||
查看远程指引。 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
git remote | |||
</syntaxhighlight>|<syntaxhighlight lang="bash">old-origin | |||
origin | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
删除远程 | |||
{{shc|<syntaxhighlight lang="bash">git remote rm old-origin</syntaxhighlight>|$|/home/kangkk}} | |||
修改远程地址 | |||
{{shc|<syntaxhighlight lang="bash"> | |||
git remote set-url origin git@w.src.corp.qihoo.net:arena/arena-exp-serve.git</syntaxhighlight>|$|/home/kangkk}} | |||
添加远程地址 | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
git remote add origin git@w.src.corp.qihoo.net:arena/arena-exp-serve.git</syntaxhighlight>|<syntaxhighlight lang="bash"> | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
{{Shc_out|<syntaxhighlight lang="bash"> | |||
git remote -v</syntaxhighlight>|<syntaxhighlight lang="bash"> | |||
origin git@v.src.corp.qihoo.net:qiwooiot/font.qiwoo.org.git (fetch) | |||
origin git@v.src.corp.qihoo.net:qiwooiot/font.qiwoo.org.git (push) | |||
</syntaxhighlight>|$|/home/kangkk}} | |||
== 远程仓库 == | |||
=== 临时分支 === | |||
{| class="wikitable" | |||
|- | |||
| git remote -v || 查询当前远程的版本 || <syntaxhighlight lang="javascript"> | |||
origin git@gitee.com:b***c/ask***-pc.git (fetch) | |||
origin git@gitee.com:b***c/ask***-pc.git (push)</syntaxhighlight> | |||
|- | |||
| <!-- git pull origin master --> || 直接拉取并合并最新代码( 不推荐 ) || 示例 | |||
|- | |||
| git fetch origin master:mastertmp || 获取最新代码到本地临时分支 || 示例 | |||
|- | |||
| git diff mastertmp || 查看本地 mastertmp 分支与当前分支的版本差异 || | |||
|- | |||
| git merge mastertmp || 合并最新临时分支到本地分支 || | |||
|- | |||
| git branch -D mastertmp || 删除本地临时分支 || | |||
|} | |||
=== 没有临时分支 === | |||
{| class="wikitable" | |||
|- | |||
| git remote -v || 查询当前远程的版本 || <syntaxhighlight lang="javascript"> | |||
origin git@gitee.com:b***c/ask***-pc.git (fetch) | |||
origin git@gitee.com:b***c/ask***-pc.git (push)</syntaxhighlight> | |||
|- | |||
| git fetch origin master || 获取远端的 origin/master 分支 || 示例 | |||
|- | |||
| git log -p master..origin/master ||查看本地 master 与远端 origin/master 的版本差异 || 示例 | |||
|- | |||
| git merge origin/master || 合并远端分支 origin/master 到当前分支 || | |||
|} | |||