[HN Gopher] Forgit: A utility tool powered by fzf for using Git ...
       ___________________________________________________________________
        
       Forgit: A utility tool powered by fzf for using Git interactively
        
       Author : kdheepak
       Score  : 55 points
       Date   : 2022-05-17 17:54 UTC (5 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | user3939382 wrote:
       | This is awesome although I solve these problems a different way
       | for my workflow. If I really need to dive into git I use Tower.
       | For adding to a commit, I basically never need to add anything
       | less than everything. In 1 step I add everything and commit with
       | a message without needing quotes:                 # git config
       | alias.add-commit !git add -A && git commit            #
       | .bash_profile       # Use like: gac this is my commit message
       | function gac ()       {          git add-commit -m "$*"        }
        
       | WalterGR wrote:
       | That UI is beautiful! What's their special sauce?
        
         | metadat wrote:
         | * TUI, aka Text UI
        
         | WorldMaker wrote:
         | A nice Terminal color theme and a good font with PowerLine
         | symbols.
        
           | WalterGR wrote:
           | Which UI toolkit?
        
             | WorldMaker wrote:
             | Skimming the code, it's a shell script so it is mostly
             | bespoke and much of it just git's built-in color
             | formatting! Also presumably some of it is fzf's UI, too.
             | There's an even less documented helper ruby app called
             | "emojify" from the same author that I couldn't quite figure
             | out what it does, given the name I assume it converts
             | something to emojis, but what and where I didn't ascertain
             | in a brief skim.
             | 
             | (ETA: There's some confusion here too, because some of
             | those screenshots is a likely unrelated "status bar" tool
             | and a Starship-like prompt. Might even be Starship.)
        
       | nittanymount wrote:
       | this is nice with the TUI, but need to remember these shortcut
       | commands, maybe will get used to or remember them after start
       | using them...
        
         | gremlinsinc wrote:
         | you could create a bash function that echo's out the aliases,
         | or perhaps feed it a keyword and it greps the commands and only
         | gives you the ones you need.
         | 
         | something like:                   fgit(){           fgcommands
         | = "git commit...\n,git rebase...\n"            # you want one
         | per line, so I'm not perfect at bash, w/out looking up how to
         | do it I think you could cat it into the commands.            if
         | [ -z $1 ]; then             echo "$fgcommands"             #
         | returns all commands           else             echo
         | "$fgcommands" | grep commit"             # returns all commands
         | with commit in.            fi         }
         | 
         | You could even have more fun w/ it by creating some script that
         | maybe remaps all your git commands so whenever you manually do
         | git commit <flags> -- it'd run the command then also convert
         | your command to a string, and run each word matching like
         | commit, rebase, etc through fgit, and create some sort of "you
         | could've done this instead"... I'd love if zsh had more things
         | like that, but I only recently switched to zsh and oh-my-zsh is
         | it so much better.
         | 
         | Think of this like in vscode when you use the command search,
         | and it shows the keybindings next to it, so you can learn to do
         | it better...
        
       | OJFord wrote:
       | Nice. I do something similar with simple scripts for fuzzy
       | finding a file/sha, and then call them in place of one being
       | expected, but this might tempt me to let someone else maintain it
       | (with undoubtedly more thought and time put into it by a long
       | shot) instead :)
       | 
       | https://github.com/OJFord/fzutils
       | 
       | I dislike all the short acronym-style aliases though; (I know
       | it's fairly popular with git) not immediately obvious if it's
       | supported to just use the usual commands.
        
       | awsation wrote:
       | I use Tig [0] and highly recommend it. I do cherry picks there
       | view blames, git greps, among other things.
       | 
       | [0]: https://jonas.github.io/tig/
        
       | kbd wrote:
       | If anyone cares, I do something similar with my git aliases:
       | https://github.com/kbd/setup/blob/master/HOME/.config/git/co...
       | 
       | So, "ga" similarly gives a fuzzy finder of files to "git add"
       | that are actually in git status, "gcp" lets me cherry pick one or
       | more commits from a branch where both the branch and commits are
       | picked with fzf, and so on.
        
         | WalterGR wrote:
         | Have you published those tools? I don't find anything relevant
         | via Googling nor searching your repos.
        
           | [deleted]
        
           | travv0 wrote:
           | What tools? That's a git config file.
        
             | WalterGR wrote:
             | `ga` and `gcp`. Are those part of git?
        
               | travv0 wrote:
               | I assumed those were aliases for `git a` and `git cp`
               | which are in the config file.
        
               | WalterGR wrote:
               | No, they're not in the config file.
               | 
               | `gcp` and `ga` are part of forgit, not OPs config. That's
               | why searching the repo didn't find anything. From the
               | phrasing, I thought they were part of OPs repo.
               | 
               | `gcp` https://github.com/wfxr/forgit/search?q=gcp
               | 
               | `ga` https://github.com/wfxr/forgit/search?q=ga
        
               | travv0 wrote:
               | See https://news.ycombinator.com/item?id=31416448
        
               | kbd wrote:
               | The only part I left out is that as part of my shell
               | config I automatically alias all my short git aliases (as
               | well as a few special cases). So "gcp" -> "git cp" etc.
               | 
               | https://github.com/kbd/setup/blob/d95653da5ab367b1e628b97
               | 537...
        
       ___________________________________________________________________
       (page generated 2022-05-17 23:01 UTC)