zoukankan      html  css  js  c++  java
  • git常用命令

    • 查看所有配置,用户信息和文件位置
    git config --list --show-origin
    
    • 用户信息配置
    git config --global user.name "user_name"
    git config --global user.email "user_email@qq.com"
    
    • 查看远程库
    git remove -v
    
    • 本地库关联远程库
    git remote add orgin xxxx.git
    
    • 删除关联的远程库
    git remote rm origin
    
    • 查看提交日志
    git log --pretty=oneline
    
    • 撤销修改某个文件
    git checkout -- <file_name>
    
    • 删除文件
    git rm <file_name>
    
    • 版本回滚
    git reset --soft|--mixed|--hard  HEAD^ # 回滚到前一个版本
    git reset --soft|--mixed|--hard  HEAD~n # 回滚到前n+1个版本
    git reset --soft|--mixed|--hard <commit_id> # 回滚到对应的commit的版本
    git reflog # 查看git reset的日志,用于恢复git reset
    
    - soft:表示保留源码,只回退到commit信息到某个版本,不涉及暂存区的回退,如果还需要提交,直接commit即可。
    - mixed:表示会保留源码,只是将git commit和暂存区信息回退到了某个版本。
    - hard:会将所有的信息回退到某个版本。
    
    • 线上版本回退,代码已经更新到远程仓库
    git revert <commit_id>
    
    • 创建分支并切换到新分支
    git checkout -b <branch_name>
    
    • 切换分支
    git checkout <branch_name>
    
    • 删除已合并的分支
    git branch -d <branch_name>
    
    • 删除未合并的分支
    git branch -D <branch_name>
    
    • 不使用Fast forward方式合并分支
    git merge --no-ff -m "message" <branch_name>
    
    • 暂存工作区
    git stash
    
    • 查看暂存工作区
    git stash list
    
    • 恢复暂存工作区
    # 第一种方式
    git stash pop 
    
    # 第二种方式
    git stash apply stash@{<id>}
    git stash drop 
    
    • 复制特定提交到当前分支
    git cherry-pick <commit_id> # 常用来将修复的bug分支合并过来,而不是将整个master分支合并过来
    
    • 变基拉取数据
    git pull --rebase # 可以减少合并的一次commit,注意本地目录必须是干净的,如果不干净,需要先commit
    
    • 查看分支
    git branch # 查看本地分支
    git branch -r # 查看远程分支
    git branch -a # 查看所有分支
    git fetch # 远程分支和本地分支同步
    
  • 相关阅读:
    二维卷积层
    gluon 实现多层感知机MLP分类FashionMNIST
    gluon实现softmax分类FashionMNIST
    gluon 实现线性回归
    GPU使用
    Python迭代器和生成器
    L2范数惩罚项,高维线性回归
    多项式拟合
    模型选择,欠拟合,过拟合
    多层感知机MLP的gluon版分类minist
  • 原文地址:https://www.cnblogs.com/dwtfukgv/p/14650337.html
Copyright © 2011-2022 走看看