+1

Allow 'Push To' from any commit, even without a branch

Sync 1 year ago updated 12 months ago 6

[1] (master)

[2]

[3] 

[4]

For years now, when I want to push commit #3 to a remote, I would do the following workaround:

  1. Temporary create a branch on that commit without checking out and simply naming it "fddsfdsfdsfdsa".
  2. Right-click on the branch from the graph
  3. Push Toenter my desired destination branch name, e.g. "backup"
  4. Delete the temp branch

As more of my colleagues are using this workaround, I wonder if the Push To functionality can be available when right-clicking on a commit, regardless of whether a branch is there or not.


We are just pushing a commit to a remote, so it shouldn't matter what the source branch is, therefore SmartGit can do the steps above behind the scenes (i.e. adding the temp branch if it's needed by the command line) if there is no existing branch?


Hello,

Can you explain a bit more why you are pushing to a branch remotly, and don't want that branch locally ?

I'm quite surprised, never had to do that...

"don't want that branch locally"

I don't understand the question. Perhaps you missed my overall intention. I'm trying to quickly push a branch that's pointing to a prior commit to remote for various reasons (e.g. backup, passing to another person as starting point, etc,)

Here's a video to explain it:

(sorry for the screen cut off.  I basically did:  (1) Add fdsfdsa (2) Push To from fdsfdsa (3) Delete fdsfdsa)

I think that is still inline with the "meaning" of Push To, so doesn't clash with the UX. It seems weird that we need a temporary branch initiate the "Push To" action from the context menu.

If the target branch is the same as the head branch, you could use Push Up To.

I'm not sure of the way you are working, that was what I was asking for.

Indeed the manipulation you're talking about surprises me as I'm used to work with feature branch, with a very atomic perimeter, send to remote (and sometimes with a PR associated) if some collaboration is needed. Not sure to understand why you want one commit of your local master to be sent to a dedicated branch on remote : why not have this commit in a feature branch ?

Not sure to understand why you want one commit of your local master to be sent to a dedicated branch on remote

The focus is not about workflow, but to expose the Push To functionality to more scenarios.  The reason has been explained, but perhaps the following example that doesn't involve master can help you understand?

   [1] (experiment-branch)

   [2]

   [3]

   [4]

   [5] <remote: master>


   "experiment-branch" is totally local, no tracking.  But I want to send 3 and 4 to others to experiment, without me leaving away from 1.

why not have this commit in a feature branch ?

From a git-level point of view, there is no difference, right?

  • I could have easily named that branch at 3 to "feature/hey-jason" in my video.  
  • If I were to do it your way, I would have to create a feature branch, check out feature, push, and go back to master to resume work.  My approach reached the same destination faster without ever leaving my master (no files are touched to cause a recompilation).  The key is here is "quick".

Yup, knew that :)

This is for other remote destinations, which is what "Push To" is for anyway.  It's just cutting down one step of creating the temp branch.