版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xiaobing_hope/article/details/74193069
I. 临时使用npm源
// 临时从淘宝的镜像源安装node-sass
npm --registry https://registry.npm.taobao.org install node-sass
II. 持久使用npm源
// 设置npm的源为淘宝的镜像源
npm config set registry https://registry.npm.taobao.org
// 查看当前npm的镜像源
npm config get registry
III. 通过cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
查看npm镜像源: npm config get registry
指定npm镜像: npm config set registry=”http://r.cnpmjs.org”
从淘宝镜像安装cnpm: npm install -g cnpm –registry=https://registry.npm.taobao.org
升级nodejs:
1. npm install -g n // 安装n模块
2. n stable // 升级nodejs到最新稳定版
Git常用命令
想要使mac上的命令行工具使用更加方便和颜色标示,可以下载 http://ohmyz.sh/
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
这样命令行工具界面会变的更加美观,使用起来也更加方便。
- 从远程分支拉取代码到本地
git clone https://....
- 切换分支
git checkout branch
- 合并远程分支到本地分支
git branch -a // 查看远程分支
git merge origin/ // 按tab健,出现远程分支的列表
git merge origin/zhangqiuhong // 将zhangqiuhong分支合并到当前分支
- 将本地分支推到远程分支上,并追踪
git push --set-upstream origin dengbingyu
// 或
git push origin dengbingyu // 这样只是在远程建立了dengbingyu分支,但是分支里面的内容需要push
- 丢弃本地更改
git checkout . && git clean -xdf
- 更新远程代码到本地
git fetch
- 将本地修改push到远程分支,完整过程
git status // 查看本地修改了哪些文件
git add . // 提交所有的修改文件
git commit -m "修改的注释" // 提交信息
git push origin dengbingyu // 将本地修改提交到远程分支
1. git stash 暂存当前分支的更改
当你正在进行项目中的某一部分工作时,还没有完成,突然来了一个紧急需求,需要切换到其他分支进行开发,但是你并不想提交进行一半的工作,强硬切换分支,会丢失当前分支未提交的修改,这个问题就要用到git stash命令解决。
git stash命令将当前分支中的修改暂存起来,并将它保存到一个未完结变更的堆栈中,随时可以重新应用。
git status // 查看当前分支上的变更文件
git stash // 暂存更改, 之后,当前分支就干净了,与远程分支代码保持了一致
git stash list // 查看现有的存储
// stash@{0}: Wip on master: 049d078 added the index file
// stash@{1}: WIP on master: c264051 Revert "added file_size"
// stash@{2}: WIP on master: 21d80a5 added number to log
git stash apply stash@{2} // 应用暂存的变更2到当前分支