nosarthur / gita

Manage many git repos with sanity 从容管理多个git库
MIT License
1.67k stars 73 forks source link

Revised symbols #245

Open tinder-cfuller opened 1 year ago

tinder-cfuller commented 1 year ago

May I kindly suggest adopting the following symbols:

symbol meaning
? Untracked changes
+ Added changes
! Unstaged files
» Renamed files
Deleted files
$ Stashed changes
= Unmerged changes
Unpushed changes (ahead of remote branch)
Unpulled changes (behind of remote branch)
Diverged changes (diverged with remote branch)

_Based on https://spaceship-prompt.sh/sections/git/#Git-status-git_status_

I also believe it would be a great style to enclose them in [ and ] as well.

For example:

$ gita ll
blog     master   [!?] minor changes (2 weeks ago)
dotfiles master   [! ] update mac colmak ah json (31 minutes ago)
gita     master   [  ] update CN readme and image (35 minutes ago)
repol    feature1 [  ] add readme (50 minutes ago)
worklog  refactor [  ] Update onboard-desmond.m (7 months ago)
tinder-cfuller commented 1 year ago

If you prefer not altering the current symbols, I am wondering if you could support two new info columns: branch_name and spaceship. Then the info.csv could be set to branch_name,spaceship,commit_msg,commit_time.

branch_name would obviously be the branch name only

tinder-cfuller commented 1 year ago

Relating to #223 the symbols could be customizable as well.

nosarthur commented 1 year ago

thanks @tinder-cfuller I didn't know about this spaceship prompt. They indeed put a lot of thought into this

I think it may be good to make gita more customizable, then everyone can have his/her favorite visualizations

nosarthur commented 1 year ago

v0.16.4 is available via pip3 install -U gita

tinder-cfuller commented 1 year ago

v0.16.4 is available via pip3 install -U gita

@nosarthur Installed! 👍

A couple things I took note of:

See the example I shared in my first message (above) that demonstrates this.

Thank you!! ❤️

nosarthur commented 1 year ago

Full alignment would require us to get status for all repos first. It would cause the terminal to be frozen if there are hundreds of repos (I don't know why ppl do that ... but there are often requests related to such usage cases)

Maybe I can do fixed width with space fillings on the branch name, say 10 characters, it would resolve most cases unless one has very long branch names. What do you think?

tinder-cfuller commented 1 year ago

Full alignment would require us to get status for all repos first. It would cause the terminal to be frozen if there are hundreds of repos (I don't know why ppl do that ... but there are often requests related to such usage cases)

Oh, that makes sense. Thanks for the explanation. 👍

Maybe I can do fixed width with space fillings on the branch name, say 10 characters, it would resolve most cases unless one has very long branch names. What do you think?

Might it help to move the symbols to their own column separate from the branch? So at least the opening brackets may all be aligned. The result could be the following:

$ gita ll
blog     master   [!?]  minor changes (2 weeks ago)
dotfiles master   [!]   update mac colmak ah json (31 minutes ago)
gita     master         update CN readme and image (35 minutes ago)
repol    feature1       add readme (50 minutes ago)
worklog  refactor       Update onboard-desmond.m (7 months ago)

☝️ Then the info columns would be branch,status,commit_msg,commit_time

nosarthur commented 1 year ago

please pip install again for a minor update for the alignment

actually the status (both the color and the edit status) is part of branch rn. I need to separate them later

tinder-cfuller commented 1 year ago

Sounds great. Thank you! 👍

yellowtailfan commented 1 year ago

These changes are looking great so far. Are you planning to add all of the symbols in https://github.com/nosarthur/gita/issues/245#issue-1799693218?

E.g. I notice that when a repo is behind main, the colour changes but there are no symbols in the brackets [].

nosarthur commented 1 year ago

yeah, that's the plan; I need to do some refactoring first

nosarthur commented 1 year ago

It seems spaceship doesn't cover all the status gita covers now. For example, local is in sync with remote, local doesn't have remote

nosarthur commented 1 year ago

please try 0.16.5

after pip install, replace branch by spaceship_status for the gita info setting

23:58 (grid-force *) 4th-wt $ cat ~/.config/gita/info.csv
spaceship_status,commit_msg,commit_time
yellowtailfan commented 1 year ago

Nice thanks! Although it would be even nicer to have both the colours and the spaceship symbols. 🚀

nosarthur commented 1 year ago

I can surely add that

nosarthur commented 1 year ago

please try 0.16.6

also, you would have to revert spaceship_status to branch

13:15 (clone-g) gita-wt3 $ cat ~/.config/gita/info.csv
branch,commit_msg,commit_time

If you want to customize the symbols, see https://github.com/nosarthur/gita#customize-information-displayed-by-the-gita-ll-command

yellowtailfan commented 1 year ago

Beautiful thankyou! 👏

tinder-cfuller commented 1 year ago

@nosarthur Thank you for making these changes! ❤️ This is great!

There are a couple additional items I would kindly suggest:

May you please re-open this issue? Or would you prefer I create new separate issues?

nosarthur commented 1 year ago

v0.16.6.4 has stash status implemented

yellowtailfan commented 11 months ago

I just noticed that gita ll --help prints a handy list of status and colour meanings. However, it's a little out of date for untracked (it has changed to ? I think?) and stash $ is missing:

$ gita ll --help
usage: gita ll [-h] [-C] [-g] [{all}]

  status symbols:
    +: staged changes
    *: unstaged changes
    _: untracked files/folders

  branch colors:
    white: local has no remote
    green: local is the same as remote
    red: local has diverged from remote
    purple: local is ahead of remote (good for push)
    yellow: local is behind remote (good for merge)
nosarthur commented 10 months ago

thanks @yellowtailfan I have updated the help message in v0.16.6.5

yellowtailfan commented 10 months ago

Much better now, thanks @nosarthur!