1.git 常用命令
1.仓库
git init
**git init <name> **
git clone <url>
2.git 配置
git config --list
git config -e
git config user.name <name>
git config user.email <email>
3.文件增删
git add <file>
git add .
git rm <file>
git rm --cached <file>
4.提交
git commit -m <message>
git commit -a 工作区直接到仓库区
5.分支
git branch
git branch <name>
git checkout <name>
git checkout -b <name>
git merge [name] 合并指定分支到当前分支
git branch -d <name> 删除指定分支
git branch -dr [name] 删除远程分支
6.标签
git tag [tag] 新建一个tag在当前commit
git tag [tag] [commit]
git tag -d [tag]
git push origin :refs/tages/[tagName] 删除远程tag
git show [tag]
git push [remote] [tage] 提交指定的tage
7.查看
git status
git log
git diff 查看暂存区和工作区的差异
git show [commit] 查看提交
8.远程仓库
git fetch [remote] 下载远程仓库的所有变动
git remote -v 显示所有远程仓库
git remote add [shortname] [url] 添加远程仓库
git pull [remote] [branch] 下载远程仓库的变化
git push [remote] [barnch] 上传本地分支到远程仓库
git push [remote] --all
9.撤销
git checkout [file] 恢复暂存区的指定文件到工作区
git reset [file] 重置暂存区文件
git revert [commit] 回退到指定提交