Giter VIP home page Giter VIP logo

blog's Introduction

前端专业配置工程师 👋

blog's People

Stargazers

 avatar

Watchers

 avatar

blog's Issues

常用css的技巧

1.单行文字两端对齐

<div>
  <span>123</span>
  <span>345</span>
</div>
div{
  text-align:justify;
  border: 1px solid red;
  overflow: hidden;
}
span{
  display:inline-block;
}
div::after{
  content: '';
  display:inline-block;
  padding-left:100%;
}

image

git常用操作记录

git rebase

git checkout bat
git rebase origin #"bat"分支里的每个提交(commit)取消掉并且把它们临时 #保存为补丁(patch)(这些补丁放到".git/rebase"目录中),然后把"bat"分支更新
#为最新的"origin"分支最后把保存的这些补丁应用到"mywork"分支上

git rebase和git merge的区别
merge相当于将双方的修改综合
rebase相当于将对方修改之后,在提交自己的修改,结果一样

git clone 取回远程的所有分支

git clone git@github.com:dolymood/angular-example.git #获取某个远程库
git fetch <远程主机名>  <分支名> #获取全部的分支 如果需要特定分支 可指定分支名
git branch -a #查看所有分支 git branch -a 查看所有分支
git checkout -b newBrach <远程分支> #创建并且切换到新的分支

返回某个文件的某个版本

git log 文件名 #查看某个文件的历史记录 可以加参数-p查看diff   获取commit id
git reset commitid 文件名 #返回该文件的当前的版本会在缓存区
git checkout 文件名 #返回之前的版本

#可以用git reflog 查看所有的版本信息
#git log --pretty=oneline filename 通过一行查看单个文件的提交情况
#git show commitid 查看该提交id的修改情况
#git log --stat 很好用,只看每次提交的增减

跳转到某个版本

git reflog #查看所有版本信息
git reset --hard commitid #重置到某个特定的版本

删除文件

git rm filename   直接删除文件
git rm --cached filename   删除文件暂存状态

创建分支

git branch develop // 只创建分支
git checkout -b master develop // 创建并切换到 develop 分支

设置 commit 的用户和邮箱

git config user.name "xx"
git config user.email "[email protected]"
git config --global color.ui true #git 显示颜色

Git设置

Git的全局设置在~/.gitconfig中单独设置在project/.git/config下忽略设置全局在~/.gitignore_global中单独设置在project/.gitignore下//设置提交的时候是否转换换行符号
git config [--global] core.autocrlf = [true|false|input]
true  : 将crlf转换为lf而在检出时将crlf转换为lf.
false : 不转换.
input : 提交时将crlf转换成lf检出时不转换.

git clean 指令

git clean -f #删除未跟踪的文件
  参数n:查看删除哪些文件
  参数x:将gitignore的文件删除,一般不用
  参数d:删除未跟踪的目录

gitignore生效

#中途加进.gitignore的文件或文件夹不会生效
git rm -r --cached .#之前已经在版本管理中了需要删除本地缓存在提交
git add .
git commit -m"add"

git add submodule

git submodule add git@github.com:zlxbuzz/gulp.git ./gulp

##删除模块
1 .gitmodules的模块信息
2 git rmcached gulp

git 更新submodule

#可以写一个submoduleupdate.sh 的脚本
git submodule init
git submodule update
git submodule foreach --recursive 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; git checkout $branch'
git submodule foreach --recursive "git submodule update"

echo "Pulling all git submodules..."
git submodule foreach --recursive 'branch="$(git config -f $toplevel/.gitmodules submodule.$name.branch)"; git pull origin $branch'

git blame 查看每行提交

git blame [选项] [版本选项] [版本] [--] 文件
    --incremental         增量式地显示发现的 blame 条目
    -b                    边界提交显示空的 SHA-1默认关闭--root                不把根提交作为边界默认关闭--show-stats          显示命令消耗统计
    --score-debug         显示判断 blame 条目位移的得分诊断信息
    -f, --show-name       显示原始文件名默认自动-n, --show-number     显示原始的行号默认关闭-p, --porcelain       显示为一个适合机器读取的格式
    --line-porcelain      为每一行显示机器适用的提交信息
    -c                    使用和 git-annotate 相同的输出模式默认关闭-t                    显示原始时间戳默认关闭-l                    显示长的SHA1提交号默认关闭-s                    隐藏作者名字和时间戳默认关闭-e, --show-email      显示作者的邮箱而不是名字默认关闭-w                    忽略空白差异
    --minimal             花费额外的循环来找到更好的匹配
    -S <文件>             使用来自 <file> 的修订集而不是调用 git-rev-list
    --contents <文件>     使用 <file> 的内容作为最终的图片
    -C[<得分>]            找到文件内及跨文件的行拷贝
    -M[<得分>]            找到文件内及跨文件的行移动
    -L <n,m>              只处理行范围在 n  m 之间的 1 开始
    --abbrev[=<n>]         <n> 位数字显示 SHA-1 哈希值

git add

用法git add [选项] [--] <路径规则>...

    -n, --dry-run         演习
    -v, --verbose         冗长输出

    -i, --interactive     交互式拣选
    -p, --patch           交互式挑选数据块
    -e, --edit            编辑当前差异并应用
    -f, --force           允许添加忽略的文件
    -u, --update          更新已跟踪的文件
    -N, --intent-to-add   只记录该路径稍后再添加
    -A, --all             添加所有改变的已跟踪文件和未跟踪文件
    --ignore-removal      忽略工作区中移除的路径 --no-all 相同--refresh             不添加只刷新索引
    --ignore-errors       跳过因出错不能添加的文件
    --ignore-missing      检查在演习模式下文件即使不存在是否被忽略

    git  add .  #新文件修改的文件
    git  add -u #修改的文件或删除的文件
    git  add -A # 所有新文件和修改的文件删除的文件

git push

git push origin --delete dev #删除远程分支

git flow

分支使用
master
与线上版本保持同步代码和功能质量满足实际发布环境需要
不直接接收任何代码commit接收来自releasehotfix分支的merge版本的tag也在此分支进行定义
develop
接收来自其他功能特性开发分支feature的mergefeature
具体功能特性的工作分支族大部分的commit在此类分支上完成完成开发后分支merge到develop分支具体feature分支删除release
用于版本发布的分支在确定版本计划后从develop分支建立用于版本的测试问题修复工作接收bug修复的commit完成测试和开发后分支merge到develop和master分支hotfix
用于在master分支发现实际环境中问题进行修复接收修复commit完成后merge回master分支并且merge到develop分支master分支需要进行修复版本tag的定义

git 对比两个tag,并且排除某些目录

 git diff 1.1.1.179...1.1.1.182 -- . ':!dist' ':!lib'

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.