git 基本命令

git status 查看状态

git add . 把所以文件提交到暂存区

git commit -m "add files"  把所有文件提交到版本区

rm 1.txt 删除文件
git reset --hard 哈希值   本地库恢复
set nu 添加行号
git diff 《文件》 文件与暂存区比较
git diff head/哈希 《文件名》文件与本地库比较 head为当前的指针
git branch -v 查看分支
git branch 《分支名》 创建分支
git branch    查看本地所有分支
git branch -r   查看远程所有分支
git branch -a   查看本地和远程的所有分支
git branch -d 删除本地分支
git branch -m <oldName> <newName> 重命名分支
git checkout 《分支名》 切换分支
git merge 《分支名》 把当前分支更新为指定的分支
mkdir <name> 新建文件夹
git remote -v 查看别名
git remote add <name> <url> 给URL添加别名
git remote set-url <name> <url>  修改URL
 
git push <remote> master  把内容推送到远程仓库
git clone <url>  克隆远程仓库
git fetch <url> <branch> 拉取远程仓库到本地(并不更改本地内容)
git checkout <url>/<branchName>   切换到远程分支
cat <fileName> 查看刚刚拉取的内容
git pull <url> <branchName> 拉取远程仓库内容并更新当前分支
冲突状态提交到本地库不需要加上文件名
原文地址:https://www.cnblogs.com/p201821460026/p/13872621.html