repo和git使用技巧

初始化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名称

 

 

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值