笔者:YY同学Serendipity
Command | Meaning |
---|---|
git log | 查看 git 日志 |
git init | 初始化 git 本地仓库 |
git add file | 添加单个文件到本地仓库 |
git reset file | 取消单个文件到本地仓库 |
git add .(推荐) | 添加当前路径下所有文件到本地仓库(会过滤 .gitignore) |
git add * | 添加全部文件到本地仓库(不会过滤 .gitignore) |
git commit -m comment | 添加更新注解 |
git remote add origin reposURL | 同步到远程仓库地址 |
git fetch origin branchName | 拉取远程仓库最新版本(不合并) |
git merge origin branchName | 合并到本地仓库 |
git pull origin branchName | 拉取远程仓库最新版本到本地合并(只拉取没有的合并) |
git pull --rebase origin branchName | 拉取远程仓库最新版本到本地合并(三方合并,取并集内容) |
git push origin branchName | 更新提交本地仓库到远程仓库 |
git push -u origin branchName | 第一次更新提交本地仓库到远程仓库 |
git push --force origin branchName | 强制更新提交本地仓库到远程仓库 |
git clone reposURL | 克隆远程仓库到本地 |
git clone -b branchName reposURL | 克隆远程仓库分支到本地 |
git branch | 列出当前分支 |
git branch branchName | 创建新分支 |
git branch -d branchName | 删除分支 |
git checkout branchName | 切换到已有分支 |
git config --list | 查看配置文件 |
git config --global user.name “Your Name” | 配置 git 用户名 |
git config --global user.email “youremail@example.com” | 配置 git 邮箱 |
随缘更新,敬请期待~