常用git命令

常用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"
  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值