2011-03-12 11 views
7

की Git बराबर मैं फ़ाइलों कि संस्करण नियंत्रण करने के लिए जाना जाता है की सूची जानना चाहते हैं।"SVN -v स्थिति"

मैं जानता हूँ कि SVN में, आप की तरह कुछ कर सकते हैं कि:

svn -v status 

तो आप

की एक सूची प्राप्त "[राजस्व # 1] [राजस्व # 2] [निर्माता] [ फ़ाइल नाम] "

राजस्व # 1 पिछले संशोधन कि है इस फाइल और राजस्व # 2 पहले संशोधन इस फाइल किया है है।

इस सूची में सभी फ़ाइलें केवल लोगों को स्थानीय परिवर्तन से SVN अन्य द्वारा पता लगाया जाता है शामिल हैं।

मुझे आश्चर्य है कि कैसे Git स्थिति

उतना SVN स्थिति आदेश की तरह एक स्थिति को दर्शाता है का उपयोग कर GIT

उत्तर

4

आप ज करना Git साथ SVN स्थिति का एक समकक्ष के लिए this proposition एवेन्यू:

git config alias.svn-status \!"\ 
{ \ 
git ls-files -o --directory -t ; \ 
git status | grep --color=never 'deleted: ' | sed 's|^.*deleted: ||' | sed 's|^|D |' ; \ 
git ls-files -m -s | awk '{print \$NF}' | sort -u | sed 's|^|M |' ; \ 
} \ 
| sort -k 2 \ 
| sed 's|^\\(.\\) *|\\1  |'" 

मैं इस SO question में git log --name-statusTechism ने उल्लेख किया (टिप्पणी में) पर शक उर्फ ​​छोटा बना सकता है।

इसका संस्करण वास्तव में diff --name-status पर आधारित है:

svn-status = "! git ls-files --exclude-per-directory=.gitignore --exclude-from=.git/info/exclude --exclude-from=$HOME/.gitignore --others -t | sed 's| |\t|'; git diff HEAD --name-status " 
3

यह करने के लिए।

ईजी:

> $ git status 
> # On branch master 
> # Your branch is ahead of 'origin/master' by 2 commits. 
> # 
> # Changed but not updated: 
> # (use "git add/rm <file>..." to update what will be committed) 
> # (use "git checkout -- <file>..." to discard changes in working 
> directory) 
> # 
> # modified: Gemfile 
> # modified: Gemfile.lock 
> # modified: app/controllers/application_controller.rb 
> # modified: app/controllers/home_controller.rb 
> # modified: app/controllers/projects_controller.rb 
> ... 

अतिरेक के लिए, यह समान प्रश्न से जवाब दोहरा:

List all the files that ever existed in a Git repository

git log --pretty=format: --name-only --diff-filter=A | sort - 

या

git log --pretty=format: --name-status | cut -f2- | sort -u 
+2

"SVN -v स्थिति" सभी फ़ाइलें SVN द्वारा पता लगाया जाता है पता चलता है। मुझे लगता है कि "गिट स्टेटस" केवल उन फ़ाइलों को दिखाता है जो स्थानीय रूप से बदल जाते हैं। – Vicky

+0

या शायद आप गिट diff चाहते हैं? – Techism

+0

दरअसल: यह धागा आपके प्रश्न का उत्तर देता है मुझे लगता है ... http://stackoverflow.com/questions/543346/git-list-all-the-files-that-ever-existed – Techism