聘我网

新概念招聘3.0

为何编译git后根目录会有那么多相同的可执行文件?

vote up0vote downstar
 git                     
 git-add                 
 git-annotate            
 git-apply               
 git-archive             
 git-bisect--helper      
 git-blame               
 git-branch              
 git-bundle              
 git-cat-file            
 git-check-attr          
 git-checkout            
 git-checkout-index      
 git-check-ref-format    
 git-cherry              
 git-cherry-pick         
 git-clean               
 git-clone               
 git-commit              
 git-commit-tree         
 git-config              
 git-count-objects       
 git-describe            
 git-diff                
 git-diff-files          
 git-diff-index          
 git-diff-tree           
 git-fast-export         
 git-fetch               
 git-fetch-pack          
 git-fmt-merge-msg       
 git-for-each-ref        
 git-format-patch        
 git-fsck                
 git-fsck-objects        
 git-gc                  
 git-get-tar-commit-id   
 git-grep                
 git-hash-object         
 git-help                
 git-index-pack          
 git-init                
 git-init-db             
 git-log                 
 git-ls-files            
 git-ls-remote           
 git-ls-tree             
 git-mailinfo            
 git-mailsplit           
 git-merge               
 git-merge-base          
 git-merge-file          
 git-merge-index         
 git-merge-ours          
 git-merge-recursive     
 git-merge-subtree       
 git-merge-tree          
 git-mktag               
 git-mktree              
 git-mv                  
 git-name-rev            
 git-notes               
 git-pack-objects        
 git-pack-redundant      
 git-pack-refs           
 git-patch-id            
 git-peek-remote         
 git-prune               
 git-prune-packed        
 git-push                
 git-read-tree           
 git-receive-pack        
 git-reflog              
 git-remote              
 git-remote-ext          
 git-remote-fd           
 git-replace             
 git-repo-config         
 git-rerere              
 git-reset               
 git-revert              
 git-rev-list            
 git-rev-parse           
 git-rm                  
 git-send-pack           
 git-shortlog            
 git-show                
 git-show-branch         
 git-show-ref            
 git-stage               
 git-status              
 git-stripspace          
 git-symbolic-ref        
 git-tag                 
 git-tar-tree            
 git-unpack-file         
 git-unpack-objects      
 git-update-index        
 git-update-ref          
 git-update-server-info  
 git-upload-archive      
 git-var                 
 git-verify-pack         
 git-verify-tag          
 git-whatchanged         
 git-write-tree          

我查看过,这些文件大小和内容都一样,这是怎么回事?

 

1 个答复

vote up0vote downcheck

为了向下兼容。

早期的git把每个命令都单独分割成一个可执行文件,例如git-add,而不是git add

后来的git把命令都做到了可执行文件git中,其他的只是硬链接到git

可以用ll -i命令查看这些文件的inode(第1列),都是相同的:

 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-add
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-annotate
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-apply
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-archive
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-bisect--helper
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-blame
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-branch
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-bundle
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-cat-file
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-check-attr
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-checkout
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-checkout-index
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-check-ref-format
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-cherry
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-cherry-pick
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-clean
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-clone
 44869663 -rwxrwxr-x 106 root root 4951925 2011-08-02 10:40 git-commit
 ...
链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.