6

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?

1 Answer 1

10
  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.)
6
  • 1
    Thank you, I did. Commented Oct 11, 2016 at 14:03
  • Doesn't P o work for this? Commented Oct 11, 2016 at 14:16
  • You're right. But it should be made a bit smarter by offering the appropriate branch as default choice. Commented Oct 11, 2016 at 14:28
  • 3
    and… the feature is implemented ! It's based on P o. Commented Oct 11, 2016 at 21:45
  • 1
    If you incorporate it in the answer, I’ll accept it! Oh, and Kudos for the quick implementation! Commented Oct 12, 2016 at 7:13

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.