git-extras icon indicating copy to clipboard operation
git-extras copied to clipboard

default remote push selection

Open mathstuf opened this issue 2 years ago • 3 comments
trafficstars

Reading the docs for git feature:

To Setup a remote tracking branch:

$ git feature dependencies -r upstream

Note: If no remote name is passed with the -r option, it will push to origin.

Should this instead default to what remote.pushDefault is set to?

mathstuf avatar Aug 23 '23 12:08 mathstuf

Good point - I think it should check remote.pushDefault before defaulting to origin. We might need to make this change repository-wide...

hyperupcall avatar Aug 23 '23 13:08 hyperupcall

Then again, I'm not sure if that allows the "triangle setup". For example, origin for me is always the "main" repo (I never got the upstream for that and origin for my fork because remote.pushDefault makes the distinction of where to publish, by default, clear). If I have a fork, it is github (or gitlab or whatever) and other forks are gh/$uname. My remote.pushDefault is github, but I do git branch --set-upstream-to=origin/master (or origin/main or whatever makes sense) as this makes vim-fugitive show:

  • what my base branch has that I'm missing
  • what is remote for the branch on my fork and not locally
  • what is on my branch and not in the base branch

which is everything that I find important when working with topic branches.

But that can certainly be a separate issue/effort. Using remote.pushDefault where it makes sense sounds just fine as an incremental change.

mathstuf avatar Aug 23 '23 14:08 mathstuf

We can improve the git-feature to select the remote automatically. PR is welcome!

spacewander avatar Aug 24 '23 02:08 spacewander