1. Git的安装
首先在安装之前确认一下系统有没有安装Git。在Terminal中输入:
git --version
若确认系统没有安装git,可通过以下指南安装:
Getting Started - Installing Git
2. 创建本地Git库
每次进行新项目时,都需要创建一个新的git库用以存储和记录所有的代码文件。
首先,在桌面创建一个新的文件夹,命名为:git-sample。
现在,我们可以在这个新的文件夹下创建/初始化本地Git库。在Terminal中输入:
cd ~/Desktop/git-sample
git init
创建本地Git库后,作为例子,我们可以在文件夹git-sample下存储两个python代码文件:
文件一:names.py
names = ['Alice', 'Betty', 'Cathy', 'Doris']
文件二:ages.py
ages = [23, 20<