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

    # 在当前目录新建一个Git代码库
    $ git init 
    # 下载一个项目和它的整个代码历史
    $ git clone [url]
    # 下载远程仓库的所有变动
    $ git fetch [remote]
    # 显示所有远程仓库
    $ git remote -v
    
    # 增加一个新的远程仓库,并命名
    $ git remote add [shortname] [url]
    # 添加当前目录的所有文件到暂存区
    $ git add .
    # 提交暂存区到仓库区
    $ git commit -m [message]
    # 合并指定分支到当前分支
    $ git merge [branch]
    # 取回远程仓库的变化,并与本地分支合并
    $ git pull [remote] [branch]
    # 上传本地指定分支到远程仓库
    $ git push [remote] [branch] (--force)


    # 列出所有本地分支
    $ git branch
    # 新建一个分支,但依然停留在当前分支
    $ git branch [branch-name]
    # 切换到指定分支,并更新工作区
    $ git checkout [branch-name]
    # 新建一个分支,并切换到该分支
    $ git checkout -b [branch]
    # 删除分支
    $ git branch -d [branch-name]
    # 删除远程分支
    $ git push origin --delete [branch-name]
    $ git branch -dr [remote/branch]

    # 显示当前分支的版本历史
    $ git log
    # 显示当前分支的最近几次提交
    $ git reflog
    # 恢复暂存区的所有文件到工作区
    $ git checkout .
    # 重置当前分支的HEAD为指定commit,同时重置暂存区和工作区,与指定commit一致
    $ git reset --hard [commit]
  • 相关阅读:
    Echarts之内嵌圆环图v5.1.2
    VueX+VueRouter+Cookie实现简单登录页
    命令行安装MySQL
    mysql常用语句
    网际互联及OSI七层模型:
    阿里ICON图标,使用教程
    前端开发小技巧整理
    SQL语句
    web笔记
    jQuery
  • 原文地址:https://www.cnblogs.com/yangshifu/p/9182121.html
Copyright © 2011-2022 走看看