一. commit 和 push 的區別git作為支持分散式版本管理的工具,它管理的庫(repository)分為本地庫、遠程庫。git commit操作的是本地庫,git push操作的是遠程庫。git commit是將本地修改過的文件提交到本地庫中。git push是將本地庫中的最新信息發送給遠...
一. commit 和 push 的區別
git作為支持分散式版本管理的工具,它管理的庫(repository)分為本地庫、遠程庫。
git commit操作的是本地庫,git push操作的是遠程庫。
git commit是將本地修改過的文件提交到本地庫中。
git push是將本地庫中的最新信息發送給遠程庫。
git pull命令的作用是,取回遠程主機某個分支的更新,再與本地的指定分支合併。它的完整格式稍稍有點複雜。
1 [chenguang@iZ251httg6tZ crawler]$ cd wcg 2 [chenguang@iZ251httg6tZ wcg]$ ls 3 test2.py test.py 4 [chenguang@iZ251httg6tZ wcg]$ vim test1.py #把剛創建的文件添加到git 5 [chenguang@iZ251httg6tZ wcg]$ git add test1.py #添加文件 6 [chenguang@iZ251httg6tZ 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 [chenguang@iZ251httg6tZ 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://[email protected]: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://[email protected]:8443/r/crawler.git 34 c0c026f..65ae9e8 master -> master 35 [chenguang@iZ251httg6tZ wcg]$ git pull 36 Password for 'https://[email protected]:8443': 37 Already up-to-date. 38 [chenguang@iZ251httg6tZ wcg]$