git-extras
git-extras copied to clipboard
default remote push selection
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?
Good point - I think it should check remote.pushDefault before defaulting to origin. We might need to make this change repository-wide...
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.
We can improve the git-feature to select the remote automatically. PR is welcome!