mhutchie / vscode-git-graph

View a Git Graph of your repository in Visual Studio Code, and easily perform Git actions from the graph.
https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
Other
1.95k stars 252 forks source link

Push local branch to a remote branch with a different name #537

Open destag opened 3 years ago

destag commented 3 years ago

Describe the improvement that you'd like I would like to be able to push commits to remote branch with different name than local branch.

For example using git cli:

git push origin local-fix:remote-fix

Which creates remote branch named remote-fix

Additional context (optional) This would be very helpful when working with gerrit, where usually you don't push changes to the branch but to code review using refs/for namespace.

For example:

git push origin HEAD:refs/for/master
mhutchie commented 3 years ago

Hi @destag,

Thanks for raising this improvement request, it would definitely be a nice capability to have in Git Graph!

bradlitterell commented 1 year ago

+1 for this, some organizations won't allow users to push to "root" branch names (e.g. foo), but require users to create them in user, specific trees, such as:

git push origin --set-upstream foo:user/brad/foo

However, it is nice to work locally with shorter branch names.

I think this could be accomplished with an option text box next to Set-Upstream in the Push dialog.

image

philipp-fischer commented 4 months ago

Especially if the local branch is already tracking a remote branch with a different name, using vscode to push will simply change the name and use the same for remote as locally.