
1. 取消本地所有修改
用暂存区的文件覆盖本地,使用该命令相当危险,不给提示确认
git checkout .
2. 删除远程分支
git push <remote> --delete <branch>
git branch -r
使用下面两条命令来删除远程分支
git branch -r -d origin/branch-name
git push origin :branch-name
3. 设置upstream
创建分支后第一次推送时用该命令可设置upstream
git push -u <remote> <branch>
4. 创建并切换到新的分支
git checkout -b <branch>
5.基于远程仓库创建新分支并且切换到新分支
git checkout -b <BRANCH-NAME> <REMOTE-NAME>/<BRANCH-NAME>
6. reset
撤消合并
git log 查看后退对应版本
git reset --hard 【版本号】
网友评论