释放双眼,带上耳机,听听看~!
命令 | |
---|---|
初始化仓库 | git init |
查询分支 | git branch |
展示所有分支 | git branch -a |
删除本地指定分支 | git branch -d <BranchName> |
删除远程指定分支 | git push origin --delete <BranchName> |
拉取远程指定分支 | git fetch origin <BranchName>:<BranchName> |
查询当前git状态 | git status |
将变动加入暂存区 | git add . |
将暂存区里的改动给提交到本地的版本库 | git commit -m "描述内容" |
将改动推送到远程branch | git push origin <BranchName> |
仓库回滚指定commit版本 | git reset --hard <commit id> // hard选项,表示彻底将工作区、暂存区和版本库记录恢复到指定的版本库 |
强制推送覆盖远程仓库内容 | git push -f origin master |
远程 | 命令 |
---|---|
克隆仓库 | git clone 地址 |
克隆仓库指定分支 | git clone -b <BranchName> 地址 |
1. git pull/push时存储密码避免每次输入 | git config --global credential.helper store |
2. 编辑.gitconfig 文件 |
[user] name = your github uesrname email = your github email [credential] helper = store |
3. 生成的文件.git-credentials |