git/repo常用操作

1. 下载代码

repo init

repo sync

2. 创建分支

repo start branch --all

3. porting作业:
cd git dir
repo sync . //get all branchs
git cherry-pick commit-id
if no conflit
    done
else // has confilt
    deal with confilt
    git add/rm
    if ok
        git cherry-pick --continue
        done
    else //nok ok
        git cherry-pick --abort
        retry

4. 查看/生成/合入patch

git format-patch commit-id   // get all patches base commit-id
git show commit-id   //get all information patch of commit-id
git log -u   //get all information of git log

git am patch //apply patch with commit message

git apply patch

5. 修改上次提交

git add

git commit --amend

git commit --amend --author='Name <E-mail>' //修改作者

6. 查看本地分支与远程分支对应关系

git branch -a //查看本地和远程所有分支

git branch -vv //查看本地分支对应远程分支

git branch --set-upstream-to=origin/[remote-branch] //切换本地分支对应的远程分支

7. revert已存在提交

git revert [commit-id]

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值