repo和git使用技巧

jopen 9年前

初始化git仓库

repo init -u git://172.16.1.11/manifest.git -b 分支名称 -m wanglei.xml

 

更新仓库代码

repo sync

 

启动分支代码

repo start 分支名称 --all

 

下载新分支

repo forall -c git checkout -b  本地分支名称(自定义)  服务器分支名称

 

切换到另一个分支

repo forall -c git checkout your_branch

 

克隆分支下的某个git仓库

git clone  git://172.16.1.11/teset_dir/test.git -b test-dev

 

删除分支

repo forall -c git branch -D  分支名称

 

从本地代码中,将最近一次的修改抽取成patch

git add -u

git commit -m "correct the wrong info of charger status"

git format-patch -1

 

从分支的提交记录上抽取patch

git log

git format-patch 31accb599f63eadf07f606da9fe1e1b0fb728a65 -1

 

强制取消之前的修改,并恢复到最新版本

git reset --hard

 

将文件恢复到之前某个提交记录的版本

git log 文件名

git reset commit号

git stash

 

把patch提交到本地,以patch owner的名义提交

git am   patch名称

 

以自己的账号合入patch

patch -p1 <   patch名称


来自:http://blog.csdn.net/wlwl0071986/article/details/40832863