点选白字关注,创软助你涨坐姿
前言
或许写这篇贴文,主要是本栏在首度碰触 Git 的过程中,对 Git 配置文档的用语敬而远之,走了许多急弯。Lendelin翻查非官方的文档格式就花了许多天数,而互联网上的 Git 课堂教学大多是简单的推而广之,千疮百孔的几个习题,或者论述有问题,无法认知。这就加强了新手的自学生产成本。总而言之,新手极难找到一个循序渐进的,系统全面的,专业委员会就能立刻进阶的 Git 讲义。
第一集讲义当然面向全国新手,没有碰触过管理辅助工具基本概念的听众也能随心所欲进阶,无须担心写作会有技术难度。
由此可见,第一集贴文著重便携性,确保一切文本都是“充份且必要性的”,决不拖沓,而且全为本栏的JalgaonGrignols,新手能整本练,减少错误操作方式单次。
在此附有 Git 的浏览门牌号
https://git-scm.com/
基础篇
Git 概要
甚么是 Git?Git 能用以做甚么?
Git 就是用以管理你笔记本电脑中信上的操作方式发展史的辅助工具,类似于应用程序的历史记录。但 Git 还能复元你的文档的操作方式发展史,某一天如果你突然想寻回以前删去的文档格式或文档格式里的文本,Git 能非常随心所欲的帮你搞掂。使用Git 后,你笔记本电脑里的信上无须须要存储,也无须须要复本数个历史复本!Git 能帮你在数字水印/项目上节约很多天数。
为甚么要用Git?甚么是管理辅助工具系统?
这里引用廖雪峰大老师的生动比喻——回想一下你在使用 Word 文档格式撰写稿子或报告的时候是否有过这样的经历:
想删除一个段落,又怕将来想恢复找不回来怎么办?有办法,先把当前文档“另存为 XXX”—— 一个新的 Word 文档,再接着写,写到一定程度,再“另存为 XXX (2) ”又是一个新的文档,这样一直写下去,最后你的 Word 文档格式变成了这样:
报告.jpg
过了一段天数,你想寻回被删除的文字,但是已经记不清删除前保存在哪里了,只好一个一个文档去找,真麻烦。
看着一堆乱七八糟的文档,想保留最新的一个,然后把其他的删去,又怕哪天会用上,还不敢删,真郁闷。
最麻烦的是,有些部分须要你的同事帮助填写,于是你把文档复本给她,然后你继续修改你的文档。一天后,同事再把 Word 传回你。此时,你要思考在发给她之后到你收到她的文档期间,文档作了哪些改动,得把你的改动和她的部分合并,真头疼。
于是你想,如果有一个软件,不但能自动帮我记录每次文档的改动,还能让同事协作编辑。这样你就不用自己管理一堆类似于的文档了,也不须要把文档传来传去。如果想查看某次改动,这个软件能显示出改动发展史,岂不妙哉?
Git 用起来应该就像这个样子,它能记录每次文档的改动:
这样,你就结束了手动管理数个“版”的史前时代,进入到管理辅助工具的20世纪。
SVN 与 Git 的最主要的区别?
SVN 是集中式管理辅助工具系统,版库是集中放在中央服务器的,而干活的时候,用的都是自己的笔记本电脑,所以首先要从中央服务器哪里得到最新的版,然后干活,干完后,须要把自己做完的活推送到中央服务器。集中式管理辅助工具系统是必须联网才能工作,如果在局域网还能,带宽够大,速度够快;如果在互联网下,网速慢的话,就纳闷了。
Git 是分布式管理辅助工具系统,那么它就没有中央服务器的,每个人的笔记本电脑就是一个完整的版库。这样,工作的时候就不须要联网了,因为版都是在自己的笔记本电脑上。既然每个人的笔记本电脑都有一个完整的版库,那多人如何协作呢?比如说自己在笔记本电脑上改了文档 A,其他人也在笔记本电脑上改了文档 A。这时,你们两之间只需把各自的修改推送给对方,就能互相看到对方的修改了。(当然,实际使用的时候不会相互推送,因为两人的各自管理的版差别很大。通常须要一台24小时开着的主机作为托管仓库的服务器来管理多人协助项目)
Git 安装(Windows)
(一) 小白安装法
如果有嫌第一集安装讲义冗长看得晕头转向,或者赶天数想早点进阶 Git 的朋友,可用一路点选下一步安装 Git。因为 Git 在 Windows 的安装上非常人性化,其默认的配置已经适配绝多半数想用管理辅助工具管理自己笔记本电脑文档的用户,不论你是公司的白领或者作家还是程序员,都能马上安装使用 Git。
(二) 自定义安装
如果想自定义一套属于自己或适用于公司的Git的新手,能参考以下汉化版安装Grignols,选择合适自己/公司的配置。再也不用担心自己英文水平不过关,稀里糊涂得瞎安装啦。
Step 1
Information
信息
Please read the following important information before continuing
继续之前,请写作以下重要信息
Step 2
Select Destination Location
选择安装位置
Step 3
Select Components
选择组件
◆ Additional icons 附加图标
On the Desktop 在桌面上创建图标
◆ Windows Explorer integration Windows
windows资源管理器
Git Bash Here
Git GUI Here
◆ Git LFS (Large File Support) 大文档支持
◆ Associate .git* configuration files with the default text editor
将 .git 配置文档与默认文本编辑器相关联
◆ Associate .sh files to be run with Bash
将.sh文档关联到 Bash 运行
◆ Use a TrueType font in all console windows
在所有控制台窗口中使用 TrueType 字体
◆ Check daily for Git for Windows updates
每天检查 Git 是否有 Windows 更新
Step 4
Select Strat Menu Folder
创建开始菜单目录
Step 5
Choosing the default editor used by Git
选择 Git 使用的默认编辑器
◆ Use the Nano editor by default
默认使用 Nano 编辑器
◆ Use Vim (The ubiquitous text editor) as Gits default editor
使用 Vim 作为 Git 的默认编辑器
◆ Use Notepad++ as Gits default editor
使用 Notepad++ 作为 Git 的默认编辑器
◆ Use Visual Studio Code as Gits default editor
使用 Visual Studio Code 作为 Git 的默认编辑器
Step 6
Adjusting your PATH environment
配置PATH环境
◆ Use Git from Git Bash only
This is the safest choice as your PATH will not be modified at all.You will only be able to use the Git command line tools form Git Bash.
这是最安全的选择,因为您的 PATH 根本不会被修改。您只能使用 Git Bash 的 Git 配置文档工具。
◆ Use Git from the Windows Command Prompt
This option is considered safe as it only adds some minimal Git wrappers to your PATH to avoid cluttering your environment with optional Unix tools . You will be able to use Git from both Git Bash and the Windows Command Prompt.
这个选项被认为是安全的,因为它只向 PATH 添加一些最小的 Git 包,以避免使用可选的 Unix 辅助工具混淆环境。 您将能够从 Git Bash 和 Windows 命令提示符中使用 Git。
◆ Use Git and optional Unix tools from the Windows Command Prompt
从 Windows 命令提示符使用 Git 和可选的 Unix 辅助工具
Both Git and the optional Unix tools will be added to you PATH
Git 和可选的 Unix 辅助工具都将添加到您计算机的 PATH 中
Warning: This will override Windows tools like “find and sort”. Only use this option if you understand the implications.
警告:这将覆盖 Windows 辅助工具,如 “ find 和 sort ”。只有在了解其含义后才使用此选项。
Step 7
Choosing HTTPS transport backend
选择 HTTPS 传输后端
◆ Use the OpenSSL library
使用 OpenSSL 库
Server certificates will be validated using the ca-bundle.crt file.
服务器证书将使用 ca-bundle.crt 文档进行验证。
◆ Use the native Windows Secure Channel library
使用本地 Windows 安全通道库
Server certificates will be validated using Windows Certificate Stores. This option also allows you to use your companys internal Root CA certificates distributed e.g. via Active Directory Domain Services.
服务器证书将使用 Windows 证书存储验证。此选项还允许您使用公司的内部根 CA 证书,例如, 通过 Active Directory Domain Services 。
Step 8
Configuring the line ending conversions
配置行结束转换
◆ Checkout Windows-style, commit Unix-style line endings
Git will convert LF to CRLF when checking out text files. When committing text files,CRLF will be converted to LF .For cross-pltform projects,this is the recommended setting on Windows (“core.autocrlf” is set to “true”)
在检出文本文档时,Git 会将LF转换为 CRLF。当提交文本文档时,CRLF 将转换为 LF。 对于跨平台项目,这是 Windows 上推荐的设置(“core.autocrlf”设置为“true”)
◆ Checkout as-is , commit Unix-style line endings
Git will not perform any conversion when checking out text files. When committing text files, CRLF will be converted to LF. For cross-platform projects,this is the recommended setting on Unix (“core.autocrlf” is set to “input”)
在检出文本文档时,Git 不会执行任何转换。 提交文本文档时,CRLF 将转换为 LF。 对于跨平台项目,这是Unix 上的推荐设置 (“core.autocrlf”设置为“input”)
◆ Checkout as-is,commit as-is
Git will not perform any conversions when checking out or committing text files.Choosing this option is not recommended for cross-platform projects (“core.autocrlf”is set to “false”)
在检出或提交文本文档时,Git 不会执行任何转换。对于跨平台项目,不推荐使用此选项(“core.autocrlf”设置为“ false”)
Step 9
Configuring the terminal emulator to use with Git Bash
配置终端模拟器以与 Git Bash 一起使用
◆ Use MinTTY (the default terminal of MSYS2)
Git Bash will use MinTTY as terminal emulator,which sports a resizable window,non-rectangular selections and a Unicode font. Windows console programs (such as interactive Python) must be launched via winpty to work in MinTTY.
Git Bash 将使用 MinTTY 作为终端模拟器,该模拟器具有可调整大小的窗口,非矩形选区和 Unicode 字体。 Windows 控制台程序(如交互式 Python)必须通过winpty启动才能在 MinTTY 中运行。
◆ Use Windows default console window
Git will use the default console window of Windows (“cmd.exe”),which works well with Win32 console programs such as interactive Python or node.js , but has a very limited default scroll-back,needs to be configured to use aUnicode font in order to display non-ASCII characters correctly,and prior to Windows 10 its windows was not freely resizable and it only allowed rectangular text selections.
Git 将使用 Windows 的默认控制台窗口(“cmd.exe”),该窗口能与 Win32 控制台程序(如交互式 Python 或 node.js)一起使用,但默认的回滚非常有限,须要配置为使用 unicode 字体以正确显示非 ASCII 字符,并且在 Windows 10 之前,其窗口不能自由调整大小,并且只允许矩形文本选择。
Step 10
Configuring extra options
配置额外的选项
◆ Enable file system caching
启用文档系统缓存
File system data will be read in bulk and cached in memory for certain operations (“core.fscache” is set to “true”). This provides a significant performance boost.
文档系统数据将被批量读取并缓存在内存中用于某些操作方式(“core.fscache”设置为“true”)。 这提供了显着的性能提升。
◆ Enable Git Credential Manager
启用 Git 凭证管理器
The Git Credential Manager for Windows provides secure Git credential storage for Windows,most notably multi-factor authentication support for Visual Studio Team Services and GitHub. (requires .NET framework v4.5.1 or later).
Windows 的 Git 凭证管理器为 Windows 提供安全的Git 凭证存储,最显着的是对 Visual Studio Team Services 和 GitHub 的多因素身份验证支持。 (须要.NET Framework v4.5.1或更高版)。
◆ Enable symbolic links
启用符号链接
Enable symbolic links (requires the SeCreateSymbolicLink permission).Please note that existing repositories are unaffected by this setting.
启用符号链接(须要 SeCreateSymbolicLink 权限)。请注意,现有存储库不受此设置的影响。
Step 11
Installing
安装
Step 12
Completing the Git Setup Wizard
完成 Git 安装
版更新
Git 的升级是覆盖安装,用户能直接去官网浏览新版的 Git 安装包,当然也可使用配置文档进行升级。
$ git update-git-for-windows
本栏一开始用的是$ git update 命令,下面弹出一个警告,告诉本栏不应该使用 $ git update 命令升级 Git,要求使用 $ git update-git-for-windows 命令代替 $ git update命令。但是使用 $ git update 命令并不影响升级安装,待 Git 检查更新后,就会询问你是否安装新版[N/y]? — yes
##############————————45.4% (yum嗯…PuTTY的味道~) // 浏览完成后覆盖安装即可
创软俱乐部ISA
微信:sziitISA
一个让你涨坐姿的团队