zoukankan      html  css  js  c++  java
  • 分布式版本控制系统Git-----4.Git 常用命令整理

    1. git init  

    初始化 git 目录  

    2. git add  

    添加文件  

      

        git add fileName       #添加指定文件  

        git add -i             #手工选择要添加的文件  

        git add -A             #所有的更改操作--新建,更改,删除;  

        git add .              #只包括 新建 ,修改操作;无删除;  

        git add -u             #只包括修改,删除操作,无新建;  

        git add -p             #提交确认  

      

    3. git status  

    查看状态 

    4. git commit -m 'xxxx'  

    提交  

    5. git remote add xx git@server:user/project.git  

    指定远程库  

       git remote -v                             #查看远程仓库  

        git remote add [name] [url]               #添加远程仓库  

       git remote rm [name]                      #删除远程仓库  

       git remote set-url --push[name][newUrl]   #修改远程仓  

    6. git push origin master  

    更新到远程库 git push [remoteName] [localBranchName]  

    7. git pull  

    从远程库获取 git pull [remoteName] [localBranchName]  

    等于下面两条命令  

        git fetch  

        git merge  

      

    8. git config --global user.name "name"  

       git config --global user.email "user@example.com"  

    配置用户信息  

      

    9. .gitignore  

    创建此文本文件来忽略相关文件  

    10. clone  

       用法1: git clone          <repository> <directory>  

       用法2: git clone --bare   <repository> <directory.git>  

       用法3: git clone --mirror <repository> <directory.git>  

    这三种用法的区别如下:  

    ==>用法1 <repository> 指向的版本库创建一个克隆到 <directory> 目录。目录 <directory> 相当于克隆版本库的工作区,文件都会检出,版本库位于工作区下的 .git 目录中。  

    ==>用法2和用法3创建的克隆版本库都不包含工作区,直接就是版本库的内容,这样的版本库称为祼版本库。一般约定俗成裸版本库的目录名以 .git 为后缀,所以上面示例中将克隆出来的裸版本库目录名写作 <directory.git>  

    ==>用法3区别于用法2之处在于用法3克隆出来的裸版本对上游版本库进行了注册,这样可以在裸版本库目录中使用 git fetch 命令和上游版本库进行持续同步。  

    ==>用法3只在 1.6.0 或更高版本的 git 中才提供。 

    作者:有梦想的乌龟·
  • 相关阅读:
    window.open()弹出窗口防止被禁
    实用Javascript代码片段
    php字符串常用函数
    PHP基本使用
    php开发环境搭建
    what is php?
    Front-end Developer Interview Questions
    jQuery Questions:Front-end Developer Interview Questions
    JS Questions:Front-end Developer Interview Questions
    HTML Questions:Front-end Developer Interview Questions
  • 原文地址:https://www.cnblogs.com/nlbnick/p/6111700.html
Copyright © 2011-2022 走看看