git工作流--持续更新中

git Semantic Commit Style

feat: (new feature for the user, not a new feature for build script)
fix: (bug fix for the user, not a fix to a build script)
docs: (changes to the documentation)
style: (formatting, missing semi colons, etc; no production code change)
refactor: (refactoring production code, eg. renaming a variable)
test: (adding missing tests, refactoring tests; no production code change)
chore: (updating grunt tasks etc; no production code change)

代码风格

///FIXME:标记待修复的bug
///TODO: 标记待做
///???: 這邊還沒看懂做什麼
///!!!: 這邊也許會有問題
///MARK: 註記

git推动本地分支到远端

  1. 远程先开好分支然后拉到本地
    git checkout -b local_feature_branch origin/feature/local_feature_branch //检出远程的local_feature_branch 分支到本地

  2. 本地先开好分支然后推送到远程
    $ git checkout -b local_feature_branch //创建并切换到分支local_feature_branch
    $ git push origin local_feature_branch:feature/local_feature_branch //推送本地的local_feature_branch (冒号前面的)分支到远程origin的feature/local_feature_branch (冒号后面的)分支(没有会自动创建)

可以查看merge request 是否会和要合入的分支发生冲突,例如在feture/offline_tryAccelerate分支要合入master中;
//先更新要合入的代码
git checkout offline_tryAccelerate
git pull
//切换master
git checkout master
git merge --no-ff origin/feature/offline_tryAccelerate

如果没有冲突,可以push说明没有冲突;

git cherry-pick用法
选取[start end]全闭区间

git cherry-pick startcommitID^...endcommitID

选取前开后闭区间(startcommmitID, endcommitID]

git cherry-pick startcommitID...endcommitID

删除远端分支:
git branch -d -r origin/branch-name(-r remote)
git push origin :branch-name(冒号前面有空格,表示空)
Pushing an empty allows you to delete the ref from the remote repository.

删除远端标签

git tag -d tag_delete
git push -v origin :refs/tags/tag_delete

cherry-pick 多次提交,注意顺序,然后合并成一次提交
git rebase -i HEAD~N

一篇深有同感的文章
https://blog.csdn.net/ManyPeng/article/details/81095744

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值