我发现我其实现在也不太懂git,刚好学校给我的canvas里加了这个bootcamp让同学们自学,所以学习一下自己做个笔记。也希望这篇笔记对和我一样情况的同学有所帮助。
section 0: What is version control?
什么是版本控制?
A version control system records changes to a set of files over time. The changes to the files over time are called the history. Using a history database, you can retrieve specific, previous
versions of the files. 一个版本控制系统将会记录你对一系列文件所做出的全部更改。使用一个档案记录数据库,你可以将某个文件回溯到之前的状态,将整个项目回退到过去某个时间点的特定的状态。
使用版本控制的优点与缺点?
优点:1)If a bug is discovered, you can revert to a working version. 如果发现了一个bug,你可以将程序回退到一个能够正常工作的状态。 2)Discover which specific change caused a bug. 能够知道哪次更改造成了bug。 3)Discover which developer caused the bug. 方便知道谁造了bug。 4)Review code during collaboration. 方便合作来review code。
缺点:NONE THAT MATTER. 没有那回事啦。
Git vs. GitHub/GitLab/Etc.
Git:The backend that runs on clients and servers to support the databases. 直译的话就是在客户端和服务器上运行以支持数据库的后端。
GitHub, GitLab, etc.:Web interfaces for Git on servers. 服务器上 Git 的 Web 界面。
GitHub vs. BitBucket vs. GitLab
GitHub:Cloud hosting only. No on-site self-hosting.
BitBucket:Cloud hosting. Paid on-site self-hosting available.
GitLab:Open source with free on-site self hosting. Cloud hosting available.
section 1: Git Setup
Step 1: Installing Git. 安装Git,对于不同操作系统,对应的Git版本都可以在 https://github.com/git-guides/install-git 找到。学习command line clien的话,必须先要验证它已经被正确安装了。可以在终端中输入 git version来确认。
Step 2: Creating a GitHub Account. 在 https://github.com/join 创建新用户。一个账号可以绑定多个邮箱,但一个邮箱不能绑定多个账号。
Step 3: Recommended First-Time Setup. 第一次setup,除非有其他的偏好, 不然使用Github的用户名的邮箱来identify。使用以下命令行:
$ git config --global user.name xxxx
$ git config --global user.email xxx@xxx.com
Step 4: Connecting to GitHub Securely. 安全连接到Github上。这一步需要SSH authentication。相关操作可以在 链接🔗里查看。