git使用中常见的使用技巧

1、下载钩子脚本
scp -P 29418 -p 10.100.13.23:/hooks/commit-msg .git/hooks

scp -P 29418 -p 10.100.13.21:/hooks/commit-msg .git/hooks

      其中,10.100.13.21等是repo的IP地址


2、int 流cherry-pick提交代码:

debug  to int:

git log --oneline -10
git checkout -b QCOM_4.4_Int_local remotes/origin/QCOM_4.4_Int
git cherry-pick b62538c
git push origin HEAD:refs/for/QCOM_4.4_Int


3、回退活动

git reset --hard HEAD~3 删除最近的3次操作,删除最后一次commit,则是git reset --hard HEAD^
git reset --soft HEAD^ 恢复到commit之前的状态,(红色状态)

4、惠东到某一个tag的代码
git tag
git checkout -b 分支名 refs/tags/要回退到的tag标签
git push -f origin HEAD:refs/for/远程分支名

5、查看某一个文件的修改记录
git log --pretty=oneline 文件名


6、如果在操作中遇到如下问题:

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes
are terminated then try again. If it still fails, a git process
may have crashed in this repository earlier:
remove the file manually to continue.


解决方案:

 rm -f ./.git/index.lock

7、repo更新代码方法:

更新代码:
  多库:
       repo init -u ssh://账号名@10.100.13.23:29418/android/qiku/manifests -b 分支名      ——初始化,指定分支
repo sync -c -j2        ——只下当前分支
repo forall -c git pull origin  分支名        ——只更新指定分支


  单库:
git clone ***  --single-branch -b  分支名      ——只下当前分支
git pull origin  分支名        ——只更新指定分支
git remote set-branches --add origin branch ——添加新的远程分支
git fetch origin  分支名 ——获取新的远程分支

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值