goldstar611 / gitless

A maintained fork of the simple git interface
https://goldstar611.github.io/gitless/
MIT License
26 stars 2 forks source link

Document/Promote gl aliases #23

Open sirlucjan opened 2 years ago

sirlucjan commented 2 years ago

I hope you're not mad at me for opening more suggestions :D

Would it be technically possible to add a gitconfig equivalent? It wouldn't have to be as elaborate as in git, overall the ability to set aliases would suffice. I know you can do it in bashrc/zshrc (I have one and it works great) but I think such option would be very well received by users.

goldstar611 commented 2 years ago

Please see next message I was too careless with my tabs!

goldstar611 commented 2 years ago

Yes it's possible, I would need to investigate how to do this at run time. I've added in my own aliases for gl functions I don't think provide much differentiation such as gl push -> gl publish and gl log -> gl history. Those are easy one line changes like: https://github.com/goldstar611/gitless/commit/62c652ce04eaa8385667956ec491c46a43d9bdca and https://github.com/goldstar611/gitless/commit/54cb27ff1bc718d908276987d3fe9485fdce23d5

I'd love to know what your aliases are

sirlucjan commented 2 years ago

So far it looks like this.

alias glt="gl track"
alias glu="gl untrack"
alias glst="gl status"
alias gld="gl diff"
alias glco="gl commit"
alias glb="gl branch"
alias gltg="gl tag"
alias glch="gl checkout"
alias glm="gl merge"
alias glrs="gl resolve"
alias glf="gl fuse"
alias glre="gl remote"
alias glp="gl publish"
alias glsw="gl switch"
alias gli="gl init"
alias glh="gl history"

Of course, everything works.

lucjan at archlinux ~/Tests/zsh 20:25:43    
❯ gli                                               
✔ Local repo created in /home/lucjan/Tests/zsh
lucjan at archlinux ~/Tests/zsh 20:25:51 f1bfe9ef master    
❯ glt *
✔ File zlogin is now a tracked file
✔ File zlogout is now a tracked file
✔ File zprofile is now a tracked file
✔ File zshenv is now a tracked file
✔ File zshrc is now a tracked file
lucjan at archlinux ~/Tests/zsh 20:26:00 f1bfe9ef master    
❯ glco 
✔ Commit on branch master succeeded

Commit Id: 7a387c8ed9f7db89706b79105ba86d2c6ec0eaae
Author:    Piotr Gorski <lucjan.lucjanov@gmail.com>
Date:      Wed Feb 23 20:26:35 2022 +0100
Stats:     388 lines added, 0 lines removed

    My first gitless commit

lucjan at archlinux ~/Tests/zsh 20:26:35 7a387c8e master    
❯ glu zl*
✔ File zlogin is now an untracked file
✔ File zlogout is now an untracked file

❯ glst
On branch master, repo-directory /home/lucjan/Tests/zsh/

Tracked files with modifications:
  ➜ these will be automatically considered for commit
  ➜ use gl untrack f if you don't want to track changes to file f
  ➜ if file f was committed before, use gl checkout f to discard local changes

    There are no tracked files with modifications to list

Untracked files:
  ➜ these won't be considered for commit
  ➜ use gl track f if you want to track changes to file f

    zlogin (exists at head but not in working directory)
    zlogout (exists at head but not in working directory)

lucjan at archlinux ~/Tests/zsh 20:29:54 61859a43 master    
❯ glh -c           
61859a4 My second gitless commit
7a387c8 My first gitless commit
f1bfe9e Initialize repository
goldstar611 commented 2 years ago

Ah I see, actually there are quite a few built in aliases. I'm going to paste the gl -h output and reformat it so it makes sense

user@user-MBP:~$ gl -h
usage: gl [-h] [--version]
{
track,tr,
untrack,un,
status,st,
diff,df,
commit,ci,
branch,br,
tag,tg,
checkout,co,
merge,mg,
resolve,rs,
fuse,fs,
remote,rt,
publish,pb,push,
switch,sw,
init,in,
history,hs,log,
ignore,ig
}

That is to say, running gl hs is the same as gl history and gl log. I actually like the authors 2 letter abreviations as I think they prevent some useability issues that the git cli has, for example git commit -s and git commit -S do different things. Let me know if you already knew about these 2 letter aliases, maybe there's an opportunity for enhancing the documentation.

sirlucjan commented 2 years ago

I honestly didn't know about them. I set up my aliases to simplify my work even more. I really like the fact that gitless reads the settings from gitconfig without any problems. Thanks a lot for pointing this out.