COMMIT / 提交 · INSTALL-TUTORIAL
Git Bash安装教程 - 从下载到第一次提交手把手
第 0 步:准备(5 分钟)
第 1 步:安装(10 分钟)
第 2 步:首次配置(5 分钟)
user@windows:~ $ git config --global user.name "你的名字"
user@windows:~ $ git config --global user.email "you@example.com"
user@windows:~ $ git config --global --list
user@windows:~ $ git config --global user.email "you@example.com"
user@windows:~ $ git config --global --list
用户名与邮箱会写进每次提交记录;只在本机学习可以随意填,将来推送到 GitHub 建议用真实邮箱。
第 3 步:第一次提交(10 分钟)
user@windows:~ $ mkdir demo && cd demo
user@windows:~/demo $ git init
Initialized empty Git repository in ~/demo/.git/
user@windows:~/demo $ echo hello > readme.txt
user@windows:~/demo $ git add readme.txt
user@windows:~/demo $ git commit -m "first commit"
user@windows:~/demo $ git init
Initialized empty Git repository in ~/demo/.git/
user@windows:~/demo $ echo hello > readme.txt
user@windows:~/demo $ git add readme.txt
user@windows:~/demo $ git commit -m "first commit"
看到 commit 输出(如 1 file changed)即完成第一次提交。常用命令的含义与扩展见命令速查;接下来学什么看学习路径。