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

    Branch

    # 列出远程分支
    git branch -r
    
    # 删除远程分支
    git push -d origin {branch_name}
    git push origin :{branch_name}
    
    # 删除本地分支
    git branch -D {branch_name}
    
    # 推送到指定的上游
    git push -u origin --all
    

    Commit

    # 查找包含某个 commit 的分支
    git branch --contains {commitid}
    
    # 拷贝一个 commit 到当前分支
    git cherry-pick {commit_id}
    
    # 放弃本地版本,以远程版本为准
    git fetch origin
    git reset --hard origin/{branch_name}
    git pull
    
    # 回滚上一次提交,保留在本地工作目录
    git reset --soft HEAD^
    
    # 回滚上一次提交,删除修改
    git reset --hard HEAD^
    
    # 回滚上一次提交,产生一个新反向的 commit
    git revert {commit_id}
    

    Stash

    # 暂存
    git stash save "message ..."
    
    # 暂存未跟踪文件
    git stash --include-untracked
    

    其他

    # 清理目录
    git clean -fxd -q
    
  • 相关阅读:
    vue
    mongodb
    ejs模板引擎
    ajax
    node.js2
    node.js1
    bootstrap,ECMA
    商城
    面试:----Struts和springmvc的区别--区别上
    OpenStack
  • 原文地址:https://www.cnblogs.com/nehcdahc/p/12589459.html
Copyright © 2011-2022 走看看