2

I’m creating a big feature in one of our projects, that is close to around 20 commits in my local repository. Most of them are still subject to change with rebasing, but I’d like to push the first few stable ones for review already.

In the command line, I’d do

git push origin affec75:master

(given that affec75 is a commit somewhere in my local history.)

I tried P r (explicit refspecs), specifying origin as the remote and affec75 as the refspec, but it failed. As the generated command is git push origin affec75, I tried setting affec75:master as the refspec; it succeeds, but it’s a real pain to type. Is there a shorter way to do this?

3
  1. Move to the commit.
  2. P o to push "another branch" (despite the description in the popup, this can also push arbitrary commits).
  3. RET confirm the default source, which should be the abbreviated commit hash. If a branch points at the commit, then the commit is the second choice.
  4. RET confirm the default target, which should be the current branch. (But only if the commit is reachable from HEAD.)
| improve this answer | |
  • Thank you, I did. – GergelyPolonkai Oct 11 '16 at 14:03
  • Doesn't P o work for this? – npostavs Oct 11 '16 at 14:16
  • You're right. But it should be made a bit smarter by offering the appropriate branch as default choice. – tarsius Oct 11 '16 at 14:28
  • 3
    and… the feature is implemented ! It's based on P o. – Ehvince Oct 11 '16 at 21:45
  • If you incorporate it in the answer, I’ll accept it! Oh, and Kudos for the quick implementation! – GergelyPolonkai Oct 12 '16 at 7:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.