2013-03-25 22 views
6

Tôi thành thật không thể tìm thấy bất kỳ tài liệu chi tiết về các sản phẩm của git remote show (chắc chắn không phải trên man page)lời giải thích chi tiết về 'hiển thị từ xa git'

Đặc biệt, rõ ràng, chính xác giải thích về Local phần sẽ được đánh giá.

Một ví dụ về những gì tôi thấy khó hiểu:

Ở đây tôi có hai điều khiển từ xa, Klasgốc và sản lượng họ sản xuất:

> git remote show klas 
* remote klas 
    Fetch URL: ..\klasrepo 
    Push URL: ..\klasrepo 
    HEAD branch: master 
    Remote branches: 
    experiment tracked 
    feature  tracked 
    master  tracked 
    pu   tracked 
    stashbranch tracked 
    Local branch configured for 'git pull': 
    pu merges with remote pu 
    Local refs configured for 'git push': 
    experiment pushes to experiment (fast-forwardable) 
    feature pushes to feature (fast-forwardable) 
    master  pushes to master  (fast-forwardable) 
    pu   pushes to pu   (up to date) 
> git remote show origin 
* remote origin 
    Fetch URL: C:/Temp/git/.\barerepo.git 
    Push URL: C:/Temp/git/.\barerepo.git 
    HEAD branch: experiment 
    Remote branches: 
    experiment tracked 
    master  tracked 
    Local branches configured for 'git pull': 
    experiment merges with remote experiment 
    master  rebases onto remote master 
    Local refs configured for 'git push': 
    experiment pushes to experiment (up to date) 
    master  pushes to master  (fast-forwardable) 

ý rằng nghiệmchủ được liệt kê dưới cả hailocal refs configured for 'git push'. Điều đó nghĩa là gì? Tôi đã cấu hình chủnghiệm để theo dõi nguồn gốc/masternguồn gốc/thí nghiệm tương ứng (và pu để theo dõi Klas/pu).

địa phương tính năng chi nhánh của tôi không được thiết lập để theo dõi bất cứ điều gì, nhưng vẫn được liệt kê dưới local refs configured for 'git push' (kết nối duy nhất có vẻ là tên giống hệt nhau, một phi theo dõi chi nhánh, foo, không được đề cập). git push trong khi trên tính năng cung cấp fatal: The current branch feature has no upstream branch. - hầu như không "chuyển tiếp nhanh".

Dường như các tiêu chí cho một chi nhánh địa phương được liệt kê dưới local refs configured for 'git push' là có xảy ra để tồn tại một chi nhánh từ xa có cùng tên không ??

Để tham khảo:

> git branch -vva 
    experiment    0cf7b2a [origin/experiment] added rand content 82 to .\rand_content.txt 
* feature     4b25f46 added rand content 62 to bar.txt 
    foo      40aee50 added rand content 17 to .\rand_content.txt 
    master     4b25f46 [origin/master] added rand content 62 to bar.txt 
    pu      44ad10b [klas/pu] added rand content 51 to doo.txt 
    remotes/klas/experiment 1f4e89b app 
    remotes/klas/feature  884e953 added rand content 80 to bar.txt 
    remotes/klas/master  57877c1 added in tobias repo 
    remotes/klas/pu   44ad10b added rand content 51 to doo.txt 
    remotes/klas/stashbranch 8678cf0 added rand content 44 to .\rand_content.txt 
    remotes/origin/HEAD  -> origin/master 
    remotes/origin/experiment 0cf7b2a added rand content 82 to .\rand_content.txt 
    remotes/origin/master  4b25f46 added rand content 62 to bar.txt 
> git config --list --local | select-string 'branch|remote' 
remote.origin.url=C:/Temp/git/.\barerepo.git 
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* 
branch.master.remote=origin 
branch.master.merge=refs/heads/master 
branch.master.rebase=true 
remote.klas.url=..\klasrepo 
remote.klas.fetch=+refs/heads/*:refs/remotes/klas/* 
branch.experiment.remote=origin 
branch.experiment.merge=refs/heads/experiment 
branch.pu.remote=klas 
branch.pu.merge=refs/heads/pu 
> git --version 
git version 1.8.1.msysgit.1 

Trả lời

4

này dường như là một lỗi trong Git 1.8.1.

Lướt mã Git nguồn (đặc biệt remote.cbuiltin/remote.c), danh sách dưới "refs địa phương cấu hình cho 'git push" được tính như sau:

refspecs đẩy
  1. thu thập cấu hình:
    • đọc .git/remotes/<remotename> (một tập tin cấu hình lỗi thời, xem git help repository-layout)
    • đọc .git/branches/<branchname> (một lỗi thời file config)
    • kiểm tra 0.123.cấu hình mục
  2. nếu bướC# 1 không tìm thấy bất cứ điều gì, sử dụng : như push chỉ refspec
  3. tất cả {địa phương, vùng xa} kết hợp chi nhánh phù hợp các refspecs đẩy thu

Lưu ý rằng thuật toán trên không chú ý đến branch.<branchname>.remote, branch.<branchname>.merge hoặc push.default.

Trong các mẫu sử dụng điển hình, bướC# 1 trong thuật toán trên sẽ không bao giờ tìm thấy bất kỳ cấu hình nào được phân tách để : sẽ được sử dụng. Refspec đó là một refspec kết hợp đơn giản, do đó, với cách sử dụng thông thường, git remote show <remotename> sẽ luôn in <branchname> pushes to <branchname> nếu có một chi nhánh có tên là <branchname> trong cả kho địa phương và từ xa.

Các vấn đề liên quan