# 建一个用 git 管理的文件夹
git init
# 设置用户,邮箱
git config --global user.name 'yourname'
git config --global user.email 'youremail'
# 查看配置
git config user.name
# 从服务器 clone 一个现有的项目,可以指定文件名
git clone https://prj_name.git [new_name]
# 从服务器 clone 一个项目的特定分支
git clone --branch=分支名 https://prj_name.git
git clone -b 分支名 https://prj_name.git
# 查看状态
git status
# 查看提交历史
git log
git log --oneline
git log -n2 #只看两行
git log -n2 --oneline
# 创建新分支,不切换分支
git branch [branch-name]
# 查看现有分支
git branch
# 基于 某个分支或 commitid 新建一个分支,并切换到该分支
git checkout -b [branch] [branch/commitid]
# 切换到指定commit
git checkout commitid
# 基于某个 commit 创建新分支
git switch -c newbranch commitid
# 查看 源
git remote -v
# 修改 源
git remote set-url origin URL
参考:
2. Git - Book
4. 可交互学习环境 Learn Git Branching
5. git命令-切换分支_木凌的博客-CSDN博客_git切换分支命令
7. git config