GIT 1 出库

git clone git pull的区别

[smbtest@localhost a]$ git init

[smbtest@localhost a]$ git clone [remote_repo_path]

[smbtest@localhost a]$git status

# On branch master

#

# Initial commit

#

# Untracked files:

#   (use "git add <file>..." to include in what will be committed)

#

#       test/

nothing added to commit but untracked files present (use "git add" to track)

[smbtest@localhost a]$ git log

fatal: bad default revision 'HEAD'

[smbtest@localhost a]$ git branch

 

[smbtest@localhost a]$ git init

[smbtest@localhost a]$ git pull [remote_repo_path]

[smbtest@localhost b]$ git status

# On branch master

nothing to commit (working directory clean)

[smbtest@localhost b]$ git log

commit 4ab6b6d53b77ba41ca94a443a6d6cf00acdfcb42

…….

[smbtest@localhost git_study]$diff -r a/.git/ b/.git/

Only in b/.git/: FETCH_HEAD

Binary files a/.git/index and b/.git/index differ

Only in b/.git/: logs

Only in b/.git/objects/pack: pack-9a714c6fd30c1addc0648e809907bb09ebff0230.idx

Only in b/.git/objects/pack: pack-9a714c6fd30c1addc0648e809907bb09ebff0230.pack

Only in b/.git/refs/heads: master

[smbtest@localhost b]$ git branch

* master

由上可见,git clone只是简单的把远端库中的内容拷贝到本地,并没有建立分支,因此拷过来的内容还没有加入tracking,也没有log信息;而git pull自动建立了master分支,内容(包括log)与远端库一致。

即使是git clone,如果要进行库操作git init也是不可缺少的:

[smbtest@localhost c]$ git clone ssh://git@sny-jira.ads.finisar.com:7999/gpon/test.git

Cloning into 'test'...

remote: Counting objects: 671, done.

remote: Compressing objects: 100% (316/316), done.

remote: Total 671 (delta 287), reused 612 (delta 263)

Receiving objects: 100% (671/671), 801.00 KiB | 88 KiB/s, done.

Resolving deltas: 100% (287/287), done.

[smbtest@localhost c]$ git status

fatal: Not a git repository (or any parent up to mount point /home)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[smbtest@localhost c]$ git log

fatal: Not a git repository (or any parent up to mount point /home)

Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

[smbtest@localhost c]$

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值