git 命令的使用(一) add commit push pull
一. 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的更多相关文章
- 2.每人自己建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别。答题人:张立鹏
第1步:创建SSH Key.在用户主目录下,看看有没有.ssh目录,如果有,再看看这个目录下有没有id_rsa和id_rsa.pub这两个文件,如果已经有了,可直接跳到下一步.如果没有,打开Shell ...
- 第二章-如何使用github建立一个HelloWorld项目,git的add/commit/push/pull/fetch/clone等基本命令用法。--答题人:杨宇杰
1.配置Git 首先在本地创建ssh 秘钥:在git bash输入: $ ssh-keygen -t rsa -C "your_email@youremail.com" eg:$ ...
- 第二章——建立一个HelloWorld项目,练习使用git的add/commit/push/pull/fetch/clone等基本命令。比较项目的新旧版本的差别-----答题者:徐潇瑞
1.首先下载安装git,很简单所以就不详细说了,当弹出一个类似的命令窗口的东西,就说明Git安装成功 2.因为Git是分布式版本控制系统,所以需要填写用户名和邮箱作为一个标识 3.接着,注册githu ...
- 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 ...
- 【记录】gitLab git命令add commit fetch pull push
最近项目使用git进行版本控制,由于之前用svn,所以对git不是太熟悉,网上一通乱找git各命令含义, 以下内容感觉讲的很详细,可以很清楚理解git提交流程,博主把重要的信息用红字标注了,更加显眼. ...
- git最基本的操作: add commit push 哈哈
Git add //添加到本地暂存区 Git commit -m”xxxxx” //添加到本地分支 Git push //添加到远端分支
- 09_EGIT插件的安装,Eclipse中克隆(clone),commit,push,pull操作演示
1 下载EGIT,下载地址:http://www.eclipse.org/egit/download/ 最终的下载地址: http://www.eclipse.org/downloads/dow ...
- Mac常用基本命令/常用Git命令
Git地址: https://github.com/mancongiOS/command-line基本命令 目录/文件的操作 mkdir "目录名" 在当前路径下创建一个文件夹 m ...
- 【3】Git命令
个人推荐的Git知识学习网站:https://git-scm.com . git常用操作图 init -> add -> commit -> remote -> push 初始 ...
随机推荐
- hihoCoder #1078 : 线段树的区间修改
题目大意及分析: 线段树成段更新裸题. 代码如下: # include<iostream> # include<cstdio> # include<cstring> ...
- POJ-1947 Rebuilding Roads (树形DP+分组背包)
题目大意:将一棵n个节点的有根树,删掉一些边变成恰有m个节点的新树.求最少需要去掉几条边. 题目分析:定义状态dp(root,k)表示在以root为根节点的子树中,删掉一些边变成恰有k个节点的新树需要 ...
- 【转】 iOS日常学习 - iOS10上关于NSPhotoLibraryUsageDescription等问题
原文网址:http://blog.csdn.net/wang631106979/article/details/52578001 最近升级了Xcode8.0,真是很多坑啊,填完一个来另外一个,今天又遇 ...
- (转)A Beginner's Guide To Understanding Convolutional Neural Networks
Adit Deshpande CS Undergrad at UCLA ('19) Blog About A Beginner's Guide To Understanding Convolution ...
- (总结)Linux下使用rsync最快速删除海量文件的方法
昨天遇到了要在Linux下删除海量文件的情况,需要删除数十万个文件.这个是之前的程序写的日志,增长很快,而且没什么用.这个时候,我们常用的删除命令rm -fr * 就不好用了,因为要等待的时间太长.所 ...
- 《FreeSWITCH: VoIP实战》:SIP 模块 - mod_sofia
SIP 模块是 FreeSWITCH 的主要模块,所以,值得拿出专门一章来讲解. 在前几章时里,你肯定见过几次 sofia 这个词,只是或许还不知道是什么意思.是这样的,Sofia-SIP 是由诺基亚 ...
- javase tutorial
http://docs.oracle.com/javase/tutorial/index.html
- xunsearch安装配置
1.wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2 2.tar -xjf xunsearch-full-lat ...
- Android记录11-控制ExpandableListView展开和关闭
Android记录11-控制ExpandableListView展开和关闭 2013年12月5日 工作记录 我们在使用ExpandableListView可能会遇到各种问题,比如说只展开一个组,关闭其 ...
- redis报错Windows error 0x70(a large memory)
redis报错Windows error 0x70 redis 嫌弃你内存不够了,就给你不开第二个实例. The Windows version of Redis allocates a large ...