Coder Social home page Coder Social logo

learning's Introduction

Learning

将平时学到的细碎的知识,整理到这里来

learning's People

Contributors

trylang avatar

Watchers

James Cloos avatar  avatar

learning's Issues

git的再学习

以前只是简单的pull和push。从没有想过更多有关git的用法。随着对项目的认知加深,方才懂得项目的妥善管理同样重要。现将自己学到用到项目中的一些小技巧记录下来。

git的再学习

推送到服务端

如果你还没有克隆现有仓库,并欲将你的仓库连接到某个远程服务器,你可以使用如下命令添加:
git remote add origin <server>
如此你就能够将你的改动推送到所添加的服务器上去了。

分支

  • 分支是用来将特性开发绝缘开来的。在你创建仓库的时候,master 是“默认的”。在其他分支上进行开发,完成后再将它们合并到主分支上。
  • 创建一个叫做“feature_x”的分支,并切换过去:git checkout -b feature_x;
  • 切换回主分支:git checkout master;
  • 把新建的分支删掉: git branch -d feature_x;
  • 除非你将分支推送到远端仓库,不然该分支就是 不为他人所见的:git push origin <branch>;

更新与合并

  • 要更新你的本地仓库至最新改动,执行:git pull,以在你的工作目录中 获取(fetch) 并 合并(merge) 远端的改动。
  • 要合并其他分支到你的当前分支(例如 master),执行:git merge <branch>;
  • 两种情况下,git 都会尝试去自动合并改动。不幸的是,自动合并并非次次都能成功,并可能导致 冲突(conflicts)。 这时候就需要你修改这些文件来人肉合并这些 冲突(conflicts) 了。改完之后,你需要执行如下命令以将它们标记为合并成功:git add <filename>, 在合并改动之前,也可以使用如下命令查看:git diff <source_branch> <target_branch>.

标签

  • 在软件发布时创建标签,是被推荐的。这是个旧有概念,在 SVN 中也有。可以执行如下命令以创建一个叫做 1.0.0 的标签:git tag 1.0.0 1b2e1d63f,1b2e1d63ff 是你想要标记的提交 ID 的前 10 位字符。使用如下命令获取提交 ID:git log,你也可以用该提交 ID 的少一些的前几位,只要它是唯一的。
  • 显示tag: git tag or git show v1.0;
  • 建立tag:
    1. lightweight(轻量级):git tag v1.0;
    2. annotated(带注释的, 只需-a就行,-m写上msg):git tag -a v1.0 -m'my version 1.0';
    3. 为过去的commit添加tag,从git log中获取commit id。再最后一个参数写入commit id。git tag -a v1.0 9fceb03
  • 删除tag: git tag -d tempTag or git tag --delete tempTag
  • 上传tag:tag默认不上传,需要自己指定上传 git push origin [tagname].
    1. 传一个: git push origin v1.2;
    2. 全部传: git push origin --tags

前端优化的注意点

网络加载类

  1. 减少http资源请求次数及大小;
    如减少没必要的图片、JavaScript、CSS 及 HTML 代码,对文件进行压缩优化,或者使用 gzip 压缩传输内
    容等都可以用来减小文件大小,缩短网络传输等待时延。
  2. 将CSS或js写到外部文件中,避免使用<script>标签直接引入;
  3. 避免页面中的空href和src。

git再学习二

为了提高代码质量,提高产品的稳定性,启用代码review框架,请每一位代码提交者控制代码质量,进行功能测试,每一位审核者检查代码逻辑。 该框架依赖gitlab的merge request功能,之后所有提交全部需要review,且工作流有一定的变化,默认情况下所有分支为保护分支,不允许git push操作,需要如下操作用以提交代码。

分支状态说明:
Develop:开发分支,代码开发使用
Release:发布版分支,develo经过代码测试后会合并到该分支,release分支作为客户,公有云发布的主分支
Master:暂无用途

工作流程:

  1.   克隆develop分支(该项目可用作测试)
    

git clone [email protected]:platform_develpoment/test.git -b develop

  1.   创建自己的研发分支,也可以是功能分支,bug分支,等,并提交到远端
    

git checkout –b jia

git push –u origin jia

  1.   在当前jia分支上进行功能开发,流程正常,add/commit 等,过程中需要使用git pull origin develop 来同步develop分支中其他提交
    
  2.   开发完成后,登陆网页,创建该分支到develop的merege request,选择review owner,需要详细的提交日志,bug号,改动原因等信息
    

cid:[email protected]
cid:[email protected]

  1.   Reviewer 登陆网页后会在Merge Requests里看到需要merge和review的代码,可以写评论,关闭/接受分支,接受后,分支会自动合并,如果有冲突,需要人工解决。
    

cid:[email protected]

PS:开发过程中,请尽量多执行git pull origin develop用以同步远程分支,也可以使用fetch。同时每个功能的merge尽量控制,否则太多可能导致review复杂。不允许任何提交日志中无bug/task/feature编号

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.