码迷,mamicode.com
首页 > 其他好文 > 详细

repo init & git responsity config

时间:2017-03-27 19:33:32      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:工具   服务器   gmail   支持   global   targe   ons   plt   修改版本   

1. Git Config:
git config --global user.name "Shilin Yi"
git config --global user.email "yishilin@gmail.com"
   配置git的参数变量,它可以带以下2个参数:
   --system,针对系统的所有用户的,对应的配置文件在/etc/gitconfig
   --global,针对系统当前用户的,对应的配置文件在~/.gitconfig
   不带参数,针对当前git仓库的,对应的配置文件在.git/config
   如果在个人pc上使用git,加上参数--global即可
   如果在公共服务器上使用git,则一定不要带那2个参数

git push ssh://git@dev.lemote.com/rt4ls.git master // 把本地仓库提交到远程仓库的master分支中
与以下两条语句相同:
添加一个标记,让origin指向ssh://git@dev.lemote.com/rt4ls.git,也就是说你操作origin的时候,
实际上就是在操作ssh://git@dev.lemote.com/rt4ls.git。origin在这里完全可以理解为后者的别名

git remote add origin ssh://git@dev.lemote.com/rt4ls.git
git push origin master
默认情况下这条语句等价于提交本地的master branch到远程仓库,并作为远程的master分支

git push origin test:master         // 提交本地test分支作为由origin指向的远程的master分支
git push origin test:test           // 提交本地test分支作为由origin指向的远程的test分支
如果想删除远程的分支呢?类似于上面,如果:左边的分支为空,那么将删除:右边的远程的分支
git push origin :test              // 刚提交到远程的test将被删除,但是本地还会保存的,不用担心

远程分支
我们用 (远程仓库名)/(分支名) 这样的形式表示远程分支
git branch -r  origin/HEAD -> origin/master  origin/master
git remote -vorigin  git@yottaa.unfuddle.com:yottaa/router-fm.git (fetch)origin  git@yottaa.unfuddle.com:yottaa/router-fm.git (push)
git fetch origin  fetch由origin标示的远程git@yottaa.unfuddle.com:yottaa/router-fm.git到本地的origin/master上(但是你不能修改origin/master上的内容)
说明:这里origin使默认的名字,你也可以取别的名字

Git pull/fetch
git fetch origin master:test  #从origin指定的远程获取最新的版本到本地的test分支上,不会自动进行merge
git pull origin master           #从origin指定的远程获取最新的版本到本地,并自动进行merge到本地当前分支上


repo 用法:相当于git 仓库repository
repo init:初始化 repo (repo是python脚本)
repo init -u URL -b branch -m “manifest.xml” -> 文件

repo sync [project list]
第一次执行,如果只执行repo sync则会下载所有的项目代码
如果指定project list则只会下载指定的项目代码

repo sync 如果不是第一次执行:
相当于执行 git remote update 或 git rebase origin/branch
repo sync会更新 .repo/manifest 文件
如果在merge 的过程中出现冲突,这需要手动运行git rebase --continue


repo update[ project-list ]
上传修改的代码 ,如果你本地的代码有所修改,那么在运行 repo sync 的时候,会提示你上传修改的代码,
所有修改的代码分支会上传到 Gerrit (基于web 的代码review 系统),
Gerrit 收到上传的代码,会转换为一个个变更,从而可以让人们来review 修改的代码。

repo diff [ project-list ]
显示提交的代码和当前工作目录代码之间的差异。

repo download  target revision
下载特定的修改版本到本地,例如:  repo download pltform/frameworks/base 1241 下载修改版本为 1241 的代码

repo start newbranchname .
创建新的branch分支。 "." 代表当前工作的branch 分支。

repo prune [project list]
删除已经merge 的 project

repo foreach [ project-lists] -c command
对每一个 project 运行 command 命令

repo forall -c

repo status
显示 project 中每个仓库的状态,并打印仓库名称。



Git配置KDiff3
文章分类:软件开发管理
Git支持很多merge工具, 我习惯用KDiff3

配置命令如下

git config --global -l
查看已经配置了什么merge工具

如果没有merge.tool和mergetool.kdiff3.path
则输入
git config --global --add merge.tool kdiff3
git config --global --add mergetool.kdiff3.path "D:/Program Files/KDiff3/kdiff3.exe"

路径根据你的安装位置

如果有

则输入
git config --global merge.tool=kdiff3
git config --global mergetool.kdiff3.path="D:/Program Files/KDiff3/kdiff3.exe"


repo init & git responsity config

标签:工具   服务器   gmail   支持   global   targe   ons   plt   修改版本   

原文地址:http://www.cnblogs.com/neilwang446/p/6628256.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!