常用git命令备忘录
##git配置
git config --global user.name "name"
git config --global user.email "email"
git config -l 查看所有的配置信息,依次是系统级别、用户级别、仓库级别
git config --system -l 查看系统配置
git config --global -l 查看用户配置
git config --local -l 查看仓库配置
##ssh秘钥生成
ssh-keygen -t rsa -C "email"
ssh -T git@github.com
##切换并关联远程分支
git checkout -b mybranch origin/mybranch
##remote分支删除同步
1. git remote prune --dry-run origin 查看当前有哪些是该消失还存在的分支
2. git remote prune origin 删除上面展示的所有分支
3. git fetch --prune origin 如果没有结果输出说明已经删除完成了
##本地代码库回滚:
git reset --hard commit-id :回滚到commit-id,讲commit-id之后提交的commit都去除
git reset --hard HEAD~3:将最近3次的提交回滚
##远程代码库回滚:
1、git checkout the_branch
2、git pull
3、git branch the_branch_backup //备份一下这个分支当前的情况
4、git reset --hard the_commit_id //把the_branch本地回滚到the_commit_id
5、git push origin :the_branch //删除远程 the_branch
6、git push origin the_branch //用回滚后的本地分支重新建立远程分支
7、git push origin :the_branch_backup //如果前面都成功了,删除这个备份分支
##windows
netstat -aon|findstr "8080"
tasklist|findstr "8080"