一. commit 和 push 的区别

git作为支持分布式版本管理的工具,它管理的库(repository)分为本地库、远程库。

git commit操作的是本地库,git push操作的是远程库。

git commit是将本地修改过的文件提交到本地库中。

git push是将本地库中的最新信息发送给远程库。

git pull命令的作用是,取回远程主机某个分支的更新,再与本地的指定分支合并。它的完整格式稍稍有点复杂。

git pull = git fetch + git merge

注:git add之前,应该先git pull一下;git add 后面是空文件夹的话,添加不上

 [ch@1httg6tZ crawler]$ cd wcg
[ch@1httg6tZ wcg]$ ls
test2.py test.py
[ch@1httg6tZ wcg]$ vim test1.py #把刚创建的文件添加到git
[ch@1httg6tZ wcg]$ git add test1.py #添加文件
[ch@1httg6tZ wcg]$ git commit -m 'add new file' #将本地修改的文件提交到本地库中
[master 65ae9e8] add new file
file changed, insertion(+)
create mode wcg/test1.py
[ch@1httg6tZ wcg]$ git push #把本地保存的信息发送到服务器里面
warning: push.default is unset; its implicit value is changing in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the current behavior after the default changes, use: git config --global push.default matching To squelch this message and adopt the new behavior now, use: git config --global push.default simple See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git) Password for 'https://chenguang@123.56.178.186:8443':
Counting objects: , done.
Delta compression using up to threads.
Compressing objects: % (/), done.
Writing objects: % (/), bytes | bytes/s, done.
Total (delta ), reused (delta )
remote: Resolving deltas: % (/)
remote: Updating references: % (/)
To https://chenguang@123.56.178.186:8443/r/crawler.git
c0c026f..65ae9e8 master -> master
[ch@1httg6tZ wcg]$ git pull
Password for 'https://chenguang@123.56.178.186:8443':
Already up-to-date.
[ch@1httg6tZ wcg]$

git 命令的使用(一) add commit push pull的更多相关文章

  1. 2.每人自己建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别。答题人:张立鹏

    第1步:创建SSH Key.在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步.如果没有,打开Shell ...

  2. 第二章-如何使用github建立一个HelloWorld项目,git的add/commit/push/pull/fetch/clone等基本命令用法。--答题人:杨宇杰

    1.配置Git 首先在本地创建ssh 秘钥:在git bash输入: $ ssh-keygen -t rsa -C "your_email@youremail.com" eg:$ ...

  3. 第二章——建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别-----答题者:徐潇瑞

    1.首先下载安装git,很简单所以就不详细说了,当弹出一个类似的命令窗口的东西,就说明Git安装成功 2.因为Git是分布式版本控制系统,所以需要填写用户名和邮箱作为一个标识 3.接着,注册githu ...

  4. Git CMD连接,管理(remote,add,commit,push)github repository

    git initmd testcd testgit statusgit add test  //git add test/a.txtgit status git remote add origin g ...

  5. 【记录】gitLab git命令add commit fetch pull push

    最近项目使用git进行版本控制,由于之前用svn,所以对git不是太熟悉,网上一通乱找git各命令含义, 以下内容感觉讲的很详细,可以很清楚理解git提交流程,博主把重要的信息用红字标注了,更加显眼. ...

  6. git最基本的操作: add commit push 哈哈

    Git add     //添加到本地暂存区 Git commit -m”xxxxx”   //添加到本地分支 Git push      //添加到远端分支

  7. 09_EGIT插件的安装,Eclipse中克隆(clone),commit,push,pull操作演示

     1 下载EGIT,下载地址:http://www.eclipse.org/egit/download/ 最终的下载地址: http://www.eclipse.org/downloads/dow ...

  8. Mac常用基本命令/常用Git命令

    Git地址: https://github.com/mancongiOS/command-line基本命令 目录/文件的操作 mkdir "目录名" 在当前路径下创建一个文件夹 m ...

  9. 【3】Git命令

    个人推荐的Git知识学习网站:https://git-scm.com . git常用操作图 init -> add -> commit -> remote -> push 初始 ...

随机推荐

  1. 越狱Season 1-Episode 15: By the Skin and the Teeth

    Season 1, Episode 15: By the Skin and the Teeth -Pope: doctor...you can leave. 医生你得离开 -Burrows: It's ...

  2. 错误:无法访问android.app.Activity 找不到android.app.Activity的类文件

    视频里面在工程ndk22/bin/classes中 运行javah  com.cn.ndk22.Ndk22.Activity ,出现了.h文件 但是我在bin/classes目录中运行javah 时出 ...

  3. Java设计模式之责任链设计模式

    职责链模式(Chain of Responsibility):使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系,将所有处理对象连成一条链,并沿着这条链传递请求,直到有一个对象处理 ...

  4. VIM进阶学习之几种模式和按键映射

    Map是Vim强大的一个重要原因,可以自定义各种快捷键,用起来自然得心应手. vim里最基本的map用法也就是 :map c a 这里把c映射成了a,在map生效的情况下,按下c就等同于按下了a 当然 ...

  5. javascript对时间的校验操作

    function check() { var startTime=$("#sTime").val(); var endTime=$("#eTime").val( ...

  6. ABBYY FineReader无法打开TWAIN源怎么办

    ABBYY FineReader OCR文字识别软件不仅可以将PDF文档和图像文件(包括数码照片)转换为可编辑.可搜索的格式,还可以用来扫描文档,但在扫描过程中,有时可能会出现以下两种错误信息:一是无 ...

  7. FineReader Mac如何设置参数让导出为DOCX/RTF/ODT格式

    Mac版ABBYY FineReader OCR文字识别软件识别文档之后,可以将已识别的文本保存到文件中,还可以通过电子邮件发送输出格式受FineReader支持的已识别文本,了解了ABBYY Fin ...

  8. IE下必须点击一下页面空白的地方才可以激活onchange事件

    checkbox在IE下必须点击一下页面空白的地方才可以激活onchange事件. 解决办法把onchange换成onclick

  9. shell脚本实例-菜单样例

    1.9.1 实例需求 用户在进行Linux系统管理的过程中,经常需要用到查看进程的信息.用户的信息等常用的功能.本例针对这一需求,使用shell编程实现基本的系统管理 功能.通过本程序,可以按照要求实 ...

  10. ASP.NET 3.5 中实现发送email电子邮件

    来源:红黑联盟 方法1:cs代码 using System.Net.Mail; using System.Net; string mailServerName = "smtp.qq.com& ...