Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revised symbols #245

Open
tinder-cfuller opened this issue Jul 11, 2023 · 22 comments · Fixed by #257
Open

Revised symbols #245

tinder-cfuller opened this issue Jul 11, 2023 · 22 comments · Fixed by #257

Comments

@tinder-cfuller
Copy link

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
Copy link
Author

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
Copy link
Author

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

@nosarthur
Copy link
Owner

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
Copy link
Owner

v0.16.4 is available via pip3 install -U gita

@tinder-cfuller
Copy link
Author

v0.16.4 is available via pip3 install -U gita

@nosarthur Installed! 👍

A couple things I took note of:

  • The brackets should expand to the width of the one that has the most number of symbols
  • The symbols should be moved to a dedicated column so they are all vertically aligned

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

Thank you!! ❤️

@nosarthur
Copy link
Owner

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

Sounds great. Thank you! 👍

@yellowtailfan
Copy link

These changes are looking great so far. Are you planning to add all of the symbols in #245 (comment)?

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

@nosarthur
Copy link
Owner

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

@nosarthur
Copy link
Owner

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
Copy link
Owner

nosarthur commented Jul 16, 2023

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
Copy link

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

@nosarthur
Copy link
Owner

I can surely add that

@nosarthur
Copy link
Owner

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
Copy link

Beautiful thankyou! 👏

@tinder-cfuller
Copy link
Author

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

There are a couple additional items I would kindly suggest:

  • Include $ symbol when there are stashed changes
  • Change the output order of the symbols to in_sync,no_remote,local_ahead,remote_ahead,diverged,stashed,dirty,staged,untracked or allow order customization
  • Omit the brackets when no symbols are present, meaning never output an empty []

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

@nosarthur nosarthur reopened this Jul 23, 2023
@nosarthur
Copy link
Owner

v0.16.6.4 has stash status implemented

@yellowtailfan
Copy link

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
Copy link
Owner

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

@yellowtailfan
Copy link

Much better now, thanks @nosarthur!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants