• 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 后面是空文件夹的话,添加不上

     1 [ch@1httg6tZ crawler]$ cd wcg
     2 [ch@1httg6tZ wcg]$ ls
     3 test2.py  test.py
     4 [ch@1httg6tZ wcg]$ vim test1.py                 #把刚创建的文件添加到git
     5 [ch@1httg6tZ wcg]$ git add test1.py             #添加文件
     6 [ch@1httg6tZ wcg]$ git commit -m 'add new file' #将本地修改的文件提交到本地库中
     7 [master 65ae9e8] add new file                                     
     8  1 file changed, 1 insertion(+)
     9  create mode 100644 wcg/test1.py
    10 [ch@1httg6tZ wcg]$ git push                     #把本地保存的信息发送到服务器里面
    11 warning: push.default is unset; its implicit value is changing in
    12 Git 2.0 from 'matching' to 'simple'. To squelch this message
    13 and maintain the current behavior after the default changes, use:
    14 
    15   git config --global push.default matching
    16 
    17 To squelch this message and adopt the new behavior now, use:
    18 
    19   git config --global push.default simple
    20 
    21 See 'git help config' and search for 'push.default' for further information.
    22 (the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
    23 'current' instead of 'simple' if you sometimes use older versions of Git)
    24 
    25 Password for 'https://chenguang@123.56.178.186:8443':
    26 Counting objects: 6, done.
    27 Delta compression using up to 4 threads.
    28 Compressing objects: 100% (3/3), done.
    29 Writing objects: 100% (4/4), 364 bytes | 0 bytes/s, done.
    30 Total 4 (delta 1), reused 0 (delta 0)
    31 remote: Resolving deltas: 100% (1/1)
    32 remote: Updating references: 100% (1/1)
    33 To https://chenguang@123.56.178.186:8443/r/crawler.git
    34    c0c026f..65ae9e8  master -> master
    35 [ch@1httg6tZ wcg]$ git pull
    36 Password for 'https://chenguang@123.56.178.186:8443':
    37 Already up-to-date.
    38 [ch@1httg6tZ wcg]$

  • 相关阅读:
    Spring(二):Spring框架&Hello Spring
    Spring(一):eclipse上安装spring开发插件&下载Spring开发包
    MyBatis(三):数据库查询结果不为空,但是使用MyBatis框架查询为空问题
    wrapper x64 版本发布到centos
    Oracle:常用的一些基本操作
    Java:import com.sun.awt.AWTUtilities;报错
    Eclipse中JavaSwing图形插件安装
    Hibernate(五):Hibernate配置文件及C3P0的用法
    Hibernate(四):Hello World
    Hibernate(三): org.hibernate.HibernateException: No CurrentSessionContext configured!
  • 原文地址:https://www.cnblogs.com/lovychen/p/5159990.html
Copyright © 2020-2023  润新知