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 初始 ...
随机推荐
- 《笨办法学Python》
习题一 第一个程序 print "Hello World!" print "Hello Evilxr" print "I like typing th ...
- Python学习(2)——编码
今天写了个程序但是在DOS窗口和IDEL窗口调试的结果不一样,有些郁闷~ #!/usr/bin/env python #coding=utf-8 #python version:2.7.3 #syst ...
- kuangbin_ShortPath L (POJ 2502)
dij部分还是跟模板差不多的 但是这题的难点是处理输入 或者说理解题意 事实上每个点之间都是可以走的......WA了好几发就因为没意识到同一条路线上的各个站点之间居然也可以走得比车子快.... PS ...
- 关于for,while与do while
Q:输入一个整数i,输出i+(i+1)+...+19+20的结果 S:法1:for #include<stdio.h> #include<math.h> #include< ...
- 详解LUA开发工具及其环境配置
LUA开发工具及其环境配置是本文要介绍的内容,主要是来了解并学习lua开发工具的使用和环境的配置,第一次接触LUA的话,就跟本人一起学习吧.看我能不能忽悠到你. LUA是语言,那么一定有编写的工具.第 ...
- VC++ MFC橡皮筋技术
在MFC下绘制直线,使用橡皮筋技术,可以使直线效果跟随鼠标移动 //OnLButtionDown m_ptOrigin = m_ptEnd = point; //OnMouseMove ...
- 内存使用空间之swap建置[转]
http://www.cnblogs.com/ggjucheng/archive/2012/08/22/2651502.html 内存置换空间(swap)之建置 安装时一定需要的两个 partitio ...
- CentOS6.4-RMAN定时任务备份 on 11GR2
1.rman备份脚本位置: /home/oracle ./scripts/ ./bin -----存放rman脚本 ./log ...
- CentOS 6.5系统上安装SVN服务器端的方法及步骤
VN其实就是Subversion,分为服务器端和客户端.之前在网上搜了很多方法,都有各种问题,经过自己搜集整理以及实际尝试,总算有个比较靠谱的方法.本文主要介绍CentOS 6.5系统上安装SVN服务 ...
- 关于margin和padding的总结
总结一下: 要想实现如(图一)效果,(即一个div中的子元素与父元素有间距): 如果类名为.middle的父元素没有写border,则类名为firstChild的子元素设置margin-top,会导致 ...