Power's Wiki -

Homelab - 支持多存储的文件列表程序 Alist

Alist 是一个文件列表程序,支持多种储存方式如本地、阿里云盘、OneDrive、GoogleDrive、百度网盘、夸克网盘、蓝奏云、S3、FTP / SFTP 等等,带在线视频播放器与各类文件预览(兼容 Office、PDF、Markdown 等),还有离线下载功能。 部署(Docker Compose) 首先创建 compose.yaml 文件,并粘贴以下内容: yaml title="compose.yaml" version: "3.3" services: alist: container_name: ${STACK_NAME}_app image: "xhofe/alist:${APP_VERSION}" volumes: - ${STACK_DIR}:/opt/alist/data ports: - ${APP_PORT}:5244 environment: # 需要以 root 权限运行,否则无法读取其他 docker 目录或宿主机 root 目录 - PUID=0 - PGID=0 - UMASK=022 restart: always (可选)推荐在 compose.yaml 同级目录下创建 .env 文件,并自定义你的环境变量。如果不想使用环境变量的方式,也可以直接在 compose.yaml 内自定义你的参数(比如把 ${STACK_NAME} 替换为 alist)。 ```dotenv title=".env" STACK_NAME=alist STACK_DIR=xxx # 自定义项目储存路径,例如 ./alist alist APP_VERSION=latest APP_PORT=xxxx # 自定义访问端口,选择不被占用的即可 ``` 最后,在 compose.yaml 同级目录下执行 docker compose up -d 命令即可启动编排的容器。 配置说明 接入各类网盘的方法,官方的文档写得非常详细,一步步按着配置就可以了。 参考与致谢 官网 文档 GitHub repo Docker Hub Demo site 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 Alist is a file listing program that supports multiple storage methods such as local, Alibaba Cloud Drive, OneDrive, GoogleDrive, Baidu Cloud Drive, Quark Cloud Drive, Lanzou Cloud, S3, FTP/SFTP, etc. It has an online video player and various file previews (compatible with Office, PDF, Markdown, etc.), as well as offline download function. It can be deployed using Docker Compose. The configuration details are provided in the official documentation.

相关推荐 去reddit讨论

Power's Wiki -

DC Parameters

Testing DC parameters is essentially measuring the resistivity of the silicon. They can be tested DC method, with DCVI/PPMU forcing current then measuring voltage, or forcing voltage then measuring current. Will compare the measured value with the spec value out of the tester, then conclude a test result with PASS or FAIL. Items can be tested under DC method are as follows: Power Supply Current Test (IDD) Gross IDD Test Static IDD Test Dynamic IDD Test Quiescent IDD Test (IDDQ) Leakage Test Input Leakage Test (IIL & IIH) Output Tristate Leakage Test (IOZL & IOZH) Level Threshold Test Output Level Threshold Test (VOL/IOL & VOH/IOH) Input Level Threshold Test (VIL & VIH) Optional tests Input Clamp (VI) Output Short-circuit Current (IOS) Test Resistive Inputs Test Output Fanout Test DC parameters can also be tested with digital functional method, will be compared with the spec value by voltage comparator inside the PE (Pin Electronic) during functional test procedure, and conclude a Go/No-Go test result without specific values. Metions that current is defined to positive when flow into DUT, and negative when flow outside of DUT. References & Acknowledgements The Fundamentals Of Digital Semiconductor Testing Fundamentals of Testing Using ATE Original: https://wiki-power.com/ This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

AI生成摘要 测试直流参数实际上是测量硅的电阻率。可以使用直流方法进行测试,通过DCVI/PPMU施加电流然后测量电压,或者施加电压然后测量电流。将测量值与测试仪器的规格值进行比较,然后得出测试结果为通过或失败。可以使用直流方法测试的项目包括:电源电流测试(IDD)、总IDD测试、静态IDD测试、动态IDD测试、静态IDD测试(IDDQ)、泄漏测试、输入泄漏测试(IIL和IIH)、输出三态泄漏测试(IOZL和IOZH)、电平阈值测试、输出电平阈值测试(VOL/IOL和VOH/IOH)、输入电平阈值测试(VIL和VIH)等。直流参数也可以使用数字功能方法进行测试,在功能测试过程中,通过PE(引脚电子)内的电压比较器将其与规格值进行比较,并得出一个无具体值的通过/不通过的测试结果。提到当电流流入DUT时,定义为正,当电流流出DUT时,定义为负。

相关推荐 去reddit讨论

Power's Wiki -

C 与 STM32 代码规范

参考与致谢 代码规范 V3.0.pdf

AI生成摘要 本文介绍了C与STM32代码规范,并提供了参考与致谢。

相关推荐 去reddit讨论

Power's Wiki -

Continuity Test

Continuity test contains open/short test and power pin short test. The former checks the signal pins, while the latter checks the power pin. Open/Short Continuity Test Open/short continuity test is to confirm the electronical contact between tester and DUT, and whether if short-circuit existed to other pins or to ground. Test Method Open/short continuity test is performed with testing the protection diodes (diodes to VDD and to GND). Usually use PPMU with VBT code (also can be tested using PE and functional pattern). Test through GND protection diode Force 0V to all other pins that are not tested (include power pin). Force a small negative current (-100uA) on the Pin Under Test (with voltage clamp). Meaure voltage on the Pin Under Test: Higher than max spec(>-0.2V): FAIL (Short) Midband(-1.5V~-0.2V): PASS Lower than min spec(<-1.5V): FAIL (Open) Test through VDD protection diode Force 0V to all other pins that are not tested (include power pin). Force a small positive current (+100uA) on the Pin Under Test (with voltage clamp). Meaure voltage on the Pin Under Test: Higher than max spec(>1.5V): FAIL (Short) Midband(0.2V~1.5V): PASS Lower than min spec(<0.2V): FAIL (Open) Power Pin Short Test Power pin short test is to check if there is a short-circuit from VDD to GND pin, which will cause damagement to DUT or tester. Power pin short test always run immediately after open/short continuity test, and when it fails, device power will be shut off and the DUT will be rejected. Test Method Power Pin Short Test is performed by applying a small voltage to VDD, and measure the current into it, to check if a short-circuit existed. Usually use DCVI with VBT code. Apply a small voltage to VDD (100mV) (with current clamp). Force all other pins to 0V with PPMU. Measure current flowing into VDD pin: Higher than max spec(>20uA): FAIL (Short) Midband(-1uA~20uA): PASS Lower than min spec(<-1uA): FAIL References & Acknowledgements The Fundamentals Of Digital Semiconductor Testing Fundamentals of Testing Using ATE Original: https://wiki-power.com/ This post is protected by CC BY-NC-SA 4.0 agreement, should be reproduced with attribution.

AI生成摘要 连续性测试包括开路/短路测试和电源引脚短路测试。前者检查信号引脚,后者检查电源引脚。开路/短路连续性测试用于确认测试仪与被测器之间的电子接触,并检查是否存在与其他引脚或地线的短路。开路/短路连续性测试通过测试保护二极管(连接到VDD和GND的二极管)进行。电源引脚短路测试用于检查从VDD到GND引脚的短路,如果存在短路,将导致被测器或被测器损坏。电源引脚短路测试通常在开路/短路连续性测试后立即运行,当测试失败时,设备电源将被关闭并拒绝被测器。

相关推荐 去reddit讨论

Power's Wiki -

CentOS 配置 Oh My Zsh

查看当前 Shell Shell echo $SHELL 一般情况下会返回 bin/bash 安装 zsh shell yum install -y zsh 切换默认 Shell 为 zsh 需要在 root 用户下运行此命令: shell chsh -s /bin/zsh 安装 git shell yum install -y git 安装 Oh My Zsh 自动 shell sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 或 sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 手动 如果无法通过上面的方式安装(可能因为墙),则可通过以下方式手动安装: 下载源码: shell git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh 复制配置: shell cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc 修改 Oh My Zsh 主题 列出所有主题: shell ls ~/.oh-my-zsh/themes 修改主题: shell vim ~/.zshrc 将默认主题是 ZSH_THEME="robbyrussell" 修改为自己喜欢的即可。 重启生效 shell reboot 参考与致谢 centos7 安装 zsh 配置 oh-my-zsh CentOs 安装 oh my zsh 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 本文介绍了在CentOS上配置Oh My Zsh的步骤。首先,通过查看当前Shell确认默认为bin/bash。然后,安装zsh和git。接下来,介绍了两种安装Oh My Zsh的方法:自动和手动。最后,说明了如何修改Oh My Zsh的主题,并重启使其生效。

相关推荐 去reddit讨论

Power's Wiki -

CSS 学习笔记

调用 在 HTML 的 <head> 下添加外部样式表: <link rel="stylesheet" href="xxx.css"> 其中,xxx.css 为同目录下的 CSS 文件。 注意:尽量使用 链接式的外部样式表(如上) 选择器 基本语法 css selector { prpperty: value; } 几种选择器对比 | 选择器 | 定义 | 调用 | 优先级 | | :--------- | :----------------------------- | :----------------------- | :----- | | 标签选择器 | p {...} | <p> ... </p> | 低 | | 类选择器 | .carrot {...} / p.carrot {...} | class = "carrot" | 中 | | ID 选择器 | #first {...} | id = "first" | 高 | 选择器组 用相同样式定义不同元素。 css h1, h2, h3 { color: navy; } 颜色 ```css /字体颜色/ color: #56a455; /背景色/ background-color: blue; /透明度/ /取值 0.0 ~ 1.0/ opacity: 0.5; ``` 文本 字体大小 | 样式 | 百分比 | EM 值 | | :--- | :----- | :------ | | h1 | 200% | 2em | | h2 | 150% | 1.5em | | h3 | 133% | 1.125em | | body | 100% | 1em | css /*字体大小*/ font-size: 200%; 字体选用 注:多单词组成的字体名称,要放引号,eg. 'Courier New' css /*字体选用*/ /*本地*/ font-family: "Courier New", Courier, monospace, 外链字体名称; /*外链*/ @font-face { font-family: 外链字体名称; src: url("外链地址"); } 文本格式化 默认值为 normal ```css /粗体/ font-weight: bold; /斜体/ font-style: italic; /大小写/ /uppercase,lowercase,capitalize(首字母大写)/ text-transform: uppercase; /下划线/ text-decoration: underline; /删除线/ text-decoration: line-through; /行间距/ line-height: 1.4em; /对齐/ /left,right,center,justify(两端对齐)/ text-align: left; ``` 伪类 ```css / 未访问的链接 / a:link { color: #ff0000; } / 已访问的链接 / a:visited { color: #00ff00; } / 鼠标划过链接 / a:hover { color: #ff00ff; } / 已选中的链接 / a:active { color: #0000ff; } ``` 盒子 列表,表格与表单 待补充 布局 待补充 规范 属性分类顺序 显示方法 & 布局 定位 盒模型框 外边距 边框 内边距 尺寸 文本样式 字体 文本 文字颜色 背景 轮廓 透明度 & 阴影 动效 过渡 转换变形 动画 其他 伪类 & 伪元素 引用 媒体查询 属性顺序列表 css [ [ "display", "visibility", "float", "clear", "overflow", "overflow-x", "overflow-y", "clip", "zoom" ], [ "table-layout", "empty-cells", "caption-side", "border-spacing", "border-collapse", "list-style", "list-style-position", "list-style-type", "list-style-image" ], [ "position", "top", "right", "bottom", "left", "z-index" ], [ "margin", "margin-top", "margin-right", "margin-bottom", "margin-left", "box-sizing", "border", "border-width", "border-style", "border-color", "border-top", "border-top-width", "border-top-style", "border-top-color", "border-right", "border-right-width", "border-right-style", "border-right-color", "border-bottom", "border-bottom-width", "border-bottom-style", "border-bottom-color", "border-left", "border-left-width", "border-left-style", "border-left-color", "border-radius", "border-top-left-radius", "border-top-right-radius", "border-bottom-right-radius", "border-bottom-left-radius", "border-image", "border-image-source", "border-image-slice", "border-image-width", "border-image-outset", "border-image-repeat", "padding", "padding-top", "padding-right", "padding-bottom", "padding-left", "width", "min-width", "max-width", "height", "min-height", "max-height" ], [ "font", "font-family", "font-size", "font-weight", "font-style", "font-variant", "font-size-adjust", "font-stretch", "font-effect", "font-emphasize", "font-emphasize-position", "font-emphasize-style", "font-smooth", "line-height", "text-align", "text-align-last", "vertical-align", "white-space", "text-decoration", "text-emphasis", "text-emphasis-color", "text-emphasis-style", "text-emphasis-position", "text-indent", "text-justify", "letter-spacing", "word-spacing", "text-outline", "text-transform", "text-wrap", "text-overflow", "text-overflow-ellipsis", "text-overflow-mode", "word-wrap", "word-break" ], [ "color", "background", "background-color", "background-image", "background-repeat", "background-attachment", "background-position", "background-position-x", "background-position-y", "background-clip", "background-origin", "background-size" ], [ "outline", "outline-width", "outline-style", "outline-color", "outline-offset", "opacity", "box-shadow", "text-shadow" ], [ "transition", "transition-delay", "transition-timing-function", "transition-duration", "transition-property", "transform", "transform-origin", "animation", "animation-name", "animation-duration", "animation-play-state", "animation-timing-function", "animation-delay", "animation-iteration-count", "animation-direction" ], [ "content", "quotes", "counter-reset", "counter-increment", "resize", "cursor", "user-select", "nav-index", "nav-up", "nav-right", "nav-down", "nav-left", "tab-size", "hyphens", "pointer-events" ] ] 参考与致谢 CSS 入门教程 CSS3 Tutorial 《CSS3 教程》 CSS 属性声明顺序规范 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 CSS学习笔记,介绍了调用外部样式表、选择器、颜色、文本、字体选用、文本格式化、伪类、盒子、列表、表格与表单、布局、规范、属性分类顺序、显示方法和布局、定位、盒模型框、尺寸、文本样式、背景、轮廓、透明度和阴影、动效、过渡、转换变形、动画、其他、伪类和伪元素、引用和媒体查询等内容。

相关推荐 去reddit讨论

Power's Wiki -

AD 使用 Git 的注意事项

使用 Git 管理项目 Altium Designer 支持使用 Git/SVN 用以版本控制。如果使用 Git, 直接在项目所在路径建立 Git 仓库即可。重启 Altium Designer, 会看到文件树边上出现了版本状态: 图标的含义如下: 可以在 工程(C) - 版本控制(E) 菜单直接进行 Git 操作,甚至可以直接提交 GitHub. .gitignore 文件 在使用 Altium Designer 时,软件会自动生成一些缓存文件(例如 History 文件夹),它们不但拖慢了提交速度,也污染了提交记录。这时候就要使用 .gitignore,用来忽略这些缓存文件。 适用于 Altium Designer 的 .gitignore 文件包含以下内容: ```gitignore ============================= Projects ============================= *.DesWrk Altium Workspace *.DsnWrk Altium Project Group !*.LibPkg Altium Inegrated Library Package *.PrjGrp Altium Project Group !*.PrjMbd Altium Muti-board Design Project !*.PrjPcb Altium PCB Project *.PrjScr Altium Script Project *.PrjPCBStructure ============================= Schematic ============================= *.Dot Altium Schematic Template !*.MbsDoc Altium Multi-board Schematic !*.Sch Altium Schematic Document !*.SchDoc Altium Schematic Document *.SchDot Altium Schematic Template !*.SchLib Altium Schematic Library ============================= PCB ============================= !*.MbaDoc Altium Multi-board Assembly !*.Pcb Protel PCB Document !*.PcbDoc Altium PCB Document !*.PcbLib Altium PCB Library ============================= Libraries ============================= *.CmpLib Altium Component Library !*.IntLib Altium Compiled Library !*.Lib Altium Library *.PvLib Altium Pad Via Library ============================= CAMtastic ============================= *.Apr CAMtastic Aperture Data *.Apt CAMtastic Aperture Data *.Cam Altium CAMtastic Document *.Drl CAMtastic NC Drill Binary Data ============================= Gerber ============================= *.G[1-30] CAMtastic Mid Layer 1-30 Gerber Data ============================= Outputs ============================= *.Drc Design Rule Check Report *.Drr Altium NC Drill Report File *.Net Altium Netlist File *.Nsx Simulation Netlist Document *.OutJob Altium Output Job File *.Rep Report File *.Rpt Report File ============================= Scripts ============================= *.Bas Altium Script Document *.SrcDoc Altium Script Document *.Tcl Altium Script Document ============================= Simulation ============================= *.Ckt Simulation Sub-Circuit *.LaxAn Logic Analyser Analog File *.LaxDig Logic Analyser Digital File *.Mdl Simulation Model *.Pld CUPL PLD File *.Pwl Simulation Piecewise Linear Description *.Sdf Altium Simulation Data File *.Si CUPL Simulation Input File *.So Digital Waveform File ============================= Folders ============================= __Previews/ History/ Project Logs for */ ============================= Other ============================= *.BomDoc Bom Document *.DBLib Altium Database Library File *.DBLink Altium Database Link File ``` 直接将其放在 Git 仓库的根目录即可,如果显示重复,则需与原先的 .gitignore 合并。 参考与致谢 .gitignore 文件配置:Altium Designer 工程文件类型 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 本文介绍了在使用Altium Designer进行项目管理时使用Git的注意事项。可以在项目路径下建立Git仓库,并在Altium Designer中进行Git操作和提交。同时,介绍了使用.gitignore文件来忽略一些缓存文件,以提高提交速度和净化提交记录。给出了适用于Altium Designer的.gitignore文件的内容。

相关推荐 去reddit讨论

Power's Wiki -

Homelab - 云端音乐服务器 Navidrome

Navidrome 是一个开源的基于 web 的音乐服务器和流媒体,你可以储存自己的音乐,并在多个客户端上收听。 部署(Docker Compose) 首先创建 compose.yaml 文件,并粘贴以下内容: yaml title="compose.yaml" version: "3" services: navidrome: container_name: ${STACK_NAME}_app image: deluan/navidrome:${APP_VERSION} user: 1000:1000 # 如果出现权限问题,可尝试使用root(0:0)部署 ports: - "${APP_PORT}:4533" environment: # Optional: put your config options customization here. Examples: ND_SCANSCHEDULE: 24h ND_LOGLEVEL: info ND_SESSIONTIMEOUT: 24h ND_BASEURL: "" volumes: - ${STACK_DIR}:/data - ${DATA_DIR}:/music:ro restart: unless-stopped (可选)推荐在 compose.yaml 同级目录下创建 .env 文件,并自定义你的环境变量。如果不想使用环境变量的方式,也可以直接在 compose.yaml 内自定义你的参数(比如把 ${STACK_NAME} 替换为 navidrome)。 ```dotenv title=".env" STACK_NAME=navidrome STACK_DIR=xxx # 自定义项目储存路径,例如 ./navidrome DATA_DIR=xxx # 自定义播客储存路径,例如 ./music navidrome APP_VERSION=latest APP_PORT=xxxx # 自定义访问端口,选择不被占用的即可 ``` 如果你有个 NAS,也可以通过 NFS 协议挂载 NAS 上的储存空间,把音乐储存在 NAS 上以节省服务器空间,详情请参考 Linux 下挂载群晖 NAS 硬盘拓展空间(NFS)。 最后,在 compose.yaml 同级目录下执行 docker compose up -d 命令即可启动编排的容器。 配置说明 移动端 App 有很多种选择,Android 上我自用体验最佳的是 substreamer,更多 App 可以参考官方列表 **Apps **。 参考与致谢 官网 文档 GitHub repo Docker Hub Demo site(用户名密码均为 demo) 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 Navidrome是一个开源的基于web的音乐服务器和流媒体,可以储存音乐并在多个客户端上收听。使用Docker Compose部署,创建compose.yaml文件并粘贴相关内容,可以自定义环境变量。可以通过NFS协议挂载NAS上的储存空间,以节省服务器空间。执行docker compose up -d命令启动容器。移动端App有多种选择,如substreamer。

相关推荐 去reddit讨论

Power's Wiki -

BookJourney - 二手书商城小程序

项目仓库:linyuxuanlin/BookJourney Demo(微信扫码体验): 背景 朋友想搞些副业,做在微信朋友圈卖二手书,于是托我做一个微信小程序。正逢暑假闲着没事干,于是练练手。需求是搞一个商城类的小程序,定时上架新的书籍信息,让买家自行选购。 开发 不想自己造轮子,我发现了一个不错的商城类小程序的开源项目: wechat-app-mall 于是在它的基础上,修改、添加自己想要的样式。(全局搜索很实用) 这个开源小程序原有的默认样式很不符合我的审美。我需要的效果,是能在简洁的页面上,把用户的专注聚焦在要展现的内容上。 后来,经过很多个版本的迭代,样式基本已经符合要求。 功能上,我删去了与砍价、分享有赏有关的一系列乱七八糟的东西,只留下核心功能。 因为后期商品上新不由我负责,所以后台商品编辑必须是图形化界面。BookJourney 用的是 api 工厂 的后台,省去了自己搭建服务器的过程,也方便团队成员上架新的商品。相应地,免费用户有储存限制。 避坑 开发 BookJourney 的过程中,遇到的坑不少。 就比如支付的问题,常识告诉我应该接入微信支付,方便用户下单,但微信官方阉割掉了个人注册小程序的微信支付窗口。(虽说也考虑到用户的资金安全)唯一的方法是注册一个企业账户,但首先我得有个公司。 进一步了解,我发现注册一个公司似乎并不容易。找会计事务所代理,要有办公地址,红本合同,去银行被经理审核;申请时间接近两三个月;费用要近千元,还不包括各种杂七杂八的收费…… 解决方法是,把下单的按钮直接改为联系客服。此时,用户只需要在「购物车」页面截图,直接发给负责客服的团队成员,就能下单了。 FAQ Q:为什么叫 BookJourney? A:本来有个好听的中文名字叫「书程小驿」,但在注册小程序的时候发现已经被占用了,只好妥协。 Q:赚到钱了吗? A:总利润收入:¥16.66…… 总结 经过了时间的证明,这是一个失败的项目。 前期没有认真调研市场,没有理清用户的需求,而只是做出来一个自己认为很酷的产品。以后做项目要注意不能只专攻于技术,还要更多关注市场,知道市场需要一些什么样的产品。 参考与致谢 EastWorld / wechat-app-mall 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 这篇文章讲述了作者开发一个二手书商城小程序的经历。作者在开发过程中遇到了一些问题,比如微信支付的限制和注册公司的困难。最终,作者认为这个项目是一个失败的项目,因为他没有认真调研市场和理清用户需求。作者总结了这次经历,表示以后做项目要更多关注市场需求。

相关推荐 去reddit讨论

Power's Wiki -

Git 学习笔记

安装与配置 下载安装包:git-scm.com/downloads 配置: shell git config --global user.name "username" git config --global user.email "email@example.com" 基础语句 基本流程 切换到指定的路径下:cd git-learning 初始化 Git 仓库:git init 将已存在 / 新增的文件,由 工作区 转移至 暂存区 : git add . :添加工作区的所有文件 git add xxx.xx :添加单个文件 提交更新至 暂存区分支 :git commit -m "description" 切换至某一个版本:git reset --hard commit_id 常用语句 查看修改(仅文件在工作区时可以使用):git diff 查看仓库状态:git status 查看提交历史(按照提交顺序):git log ,按 q 退出 查看命令历史(所有提交记录):git reflog 远程仓库 本地项目远程化 适用于本地已有项目文件的情况。 创建 SSH Key:ssh-keygen -t rsa -C "youremail@example.com" 更换为你的邮箱,一路回车即可 点开 GitHub 个人设置 - SSH and GPG keys,添加新的 SSH key Title 任意,Key 为 id_rsa.pub 文件中的内容 在 GitHub 新建仓库,不要勾选 Initialize this repository with a README 如果不小心初始化了仓库,则要先 pull 下来:git pull origin master 复制 SSH 地址(示例:git@github.com:linyuxuanlin/git-learning.git),在本地 Git 仓库下运行命令:git remote add origin git@server-name:user/repo-name.git 将本地内容推送到远程仓库:git push -u origin master 在出现提示信息时输入 yes 并回车继续 由于远程库是空的,我们第一次推送 master 分支时,加上了 -u 参数,Git 不但会把本地的 master 分支内容推送的远程新的 master 分支,还会把本地的 master 分支和远程的 master 分支关联起来,在以后的推送或者拉取时就可以简化命令 未来每一次提交:git push origin master 远程项目本地化 适用于从零开始,或基于别人的项目开发的情况。 将远程仓库克隆下来:git clone git@server-name:user/repo-name.git 分支管理 分支就是科幻电影里面的平行宇宙,当你正在电脑前努力学习 Git 的时候,另一个你正在另一个平行宇宙里努力学习 SVN。 如果两个平行宇宙互不干扰,那对现在的你也没啥影响。不过,在某个时间点,两个平行宇宙合并了,结果,你既学会了 Git 又学会了 SVN! 分支在实际中有什么用呢?假设你准备开发一个新功能,但是需要两周才能完成,第一周你写了 50% 的代码,如果立刻提交,由于代码还没写完,不完整的代码库会导致别人不能干活了。如果等代码全部写完再一次提交,又存在丢失每天进度的巨大风险。 现在有了分支,就不用怕了。你创建了一个属于你自己的分支,别人看不到,还继续在原来的分支上正常工作,而你在自己的分支上干活,想提交就提交,直到开发完毕后,再一次性合并到原来的分支上,这样,既安全,又不影响别人工作。 创建并切换至新分支:git switch -c branch_name -c 代表创建并切换分支 查看当前分支:git branch 将新分支内容合并到 master 上:git merge branch_name 先切换到待合并的分支,再使用合并命令(示例:先切换到 master,再执行以上命令) 当 Git 无法自动合并分支时,就必须首先解决冲突。解决冲突后,再提交,合并完成 解决冲突就是把 Git 合并失败的文件手动编辑为我们希望的内容,再提交 删除某个分支:git branch -d dev 禁用 Fast forward 合并分支:git merge --no-ff -m "commit text" branch_name 因为本次合并要创建一个新的 commit,所以加上 -m 参数,把 commit 描述写进去 Fast forward 模式下,删除分支后,会丢掉分支信息 GitHub 漫游指南 借助 GitHub 平台,我们可以发现丰富多彩的开源项目,并于全世界的开发者一起搭建开源世界。 当我们发现了一个优秀的开源项目,可以先 Fork 到自己的 GitHub 账户下(这样才拥有读写权限),然后再通过 SSH 克隆到本地进行开发。 开发完成后,可以在 GitHub 上发起一个 pull request,如果原项目所有者觉得你的修改合适,那么将并入原有的开源项目中。 GitHub CLI GitHub CLI 是 GitHub 的命令行工具,将 pull requests,issues 等功能搬到命令行使用。 下载地址:cli.github.com GitHub CLI 目前正处于 Beta 版本,值得一试。 参考与致谢 Git 教程 - 廖雪峰 实际项目中如何使用 Git 做分支管理 A successful Git branching model git-cheatsheet.pdf Pro Git GitHub CLI - Manual 20 多张精美图带你进入 Git 大门 原文地址:https://wiki-power.com/ 本篇文章受 CC BY-NC-SA 4.0 协议保护,转载请注明出处。

AI生成摘要 本文介绍了Git中分支的概念和用途。分支可以理解为平行宇宙,可以在不影响他人工作的情况下进行开发。通过创建自己的分支,在开发过程中可以随时提交代码,最后再合并到原来的分支上。这样既安全又不影响他人工作。

相关推荐 去reddit讨论