lvv / git-prompt

bash prompt with GIT, SVN and HG modules
http://volnitsky.com/project/git-prompt
327 stars 97 forks source link

Cannot enter 'Changed but not updated:' #16

Closed kuaf closed 13 years ago

kuaf commented 13 years ago

Hi,

I never enter git status 'Changed but not updated:', can you give more comments? I only see git status ' Changes not staged for commit:', which confuse me.

Thanks, Steven.l

juanpabloaj commented 13 years ago

I don't understand you question, you can put outputs.

PD: when you indent you text this is interpreted as source code

kuaf commented 13 years ago

Sorry confuse you. I am going through git-prompt.sh where you define below:

/^# Changed but not updated:/,/^# [A-Z]/ {
    s/^# Changed but not updated:/modified=modified;/p
    s/^#    modified:   '"$file_regex"'/    [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
    s/^#    unmerged:   '"$file_regex"'/    [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
}

/^# Changes not staged for commit:/,/^# [A-Z]/ {
    s/^# Changes not staged for commit:/modified=modified;/p
    s/^#    modified:   '"$file_regex"'/    [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
    s/^#    unmerged:   '"$file_regex"'/    [[ \" ${modified_files[*]} \" =~ \" \1 \" ]] || modified_files[${#modified_files[@]}]=\"\1\"/p
}

I am confused to the difference between them, i.e. Changed but not updated: and Changes not staged for commit:. If files are staged, you change it later, you'll see the prompt with git status:

$ git status
# On branch master
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   README.mkd
#
no changes added to commit (use "git add" and/or "git commit -a")

I want to know where Changed but not updated: come from as per git workflow.

lvv commented 13 years ago

1st - in index but not committed 2nd - file is modified but not staged See also git manual.