forgit icon indicating copy to clipboard operation
forgit copied to clipboard

Feature Request: `forgit::pull` and `forgit::push`

Open Dentrax opened this issue 3 years ago • 7 comments

Check list

  • [X] I have read through the README
  • [X] I have the latest version of forgit
  • [X] I have searched through the existing issues

Environment info

  • OS
    • [ ] Linux
    • [X] Mac OS X
    • [ ] Windows
    • [ ] Others:
  • Shell
    • [ ] bash
    • [X] zsh
    • [ ] fish

Problem / Steps to reproduce

I usually like to use forgit for mostly ga and gd commands. Unfortunately, it does not have push and pull commands. I want to interactively select both of remote and branch so that here is what I've been using the fzf command with git combined:

is_in_git_repo() {
  git rev-parse HEAD > /dev/null 2>&1
}

function fzfgb {
  is_in_git_repo &&
    _git_dbg branch -a -vv --color=always | grep -v '/HEAD\s' |
    fzf --height 40% --ansi --multi --tac | sed 's/^..//' | awk '{print $1}' |
    sed 's#^remotes/[^/]*/##'
}

function fzfgr {
  is_in_git_repo &&
    _git_dbg remote -v | awk '{print $1 " " $2}' | uniq |
    fzf --height 40% --tac | awk '{print $1}'
}
  • $ git push $(fzfgr) $(fzfgb)
  • $ git pull $(fzfgr) $(fzfgb)

Maybe we can make similar or better UX by implementing forgit::push and forgit::pull commands. Wdyt? Waiting your thoughts!

Dentrax avatar Oct 21 '22 19:10 Dentrax

Hi @Dentrax, thanks for your suggestion. In my opinion this would be a useful extension.

@wfxr @cjappl What do you think?

carlfriedrich avatar Oct 24 '22 08:10 carlfriedrich

@carlfriedrich Have the same opinion as you.

wfxr avatar Oct 24 '22 11:10 wfxr

Works for me!

On Mon, Oct 24, 2022 at 4:59 AM, Wenxuan @.***> wrote:

@.***(https://github.com/carlfriedrich) Have the same opinion as you.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

cjappl avatar Oct 24 '22 13:10 cjappl

Cool! So @Dentrax would you provide a PR for this yourself?

carlfriedrich avatar Oct 24 '22 13:10 carlfriedrich

Pinging @Dentrax

cjappl avatar Mar 16 '23 16:03 cjappl

Pong! @cjappl

I couldn't find to get into it but if anyone want to submit a PR for this please feel free.

Dentrax avatar Mar 16 '23 17:03 Dentrax