git work flow
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推动本地分支到远端
-
远程先开好分支然后拉到本地
git checkout -b local_feature_branch origin/feature/local_feature_branch //检出远程的local_feature_branch 分支到本地 -
本地先开好分支然后推送到远程
$ 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