[dmd-internals] Fixing github pull requests that I borked up
Jonathan M Davis
jmdavisProg at gmx.com
Tue Oct 8 03:39:25 PDT 2013
On Tuesday, October 08, 2013 01:56:21 Walter Bright wrote:
> On 10/8/2013 1:25 AM, Jonathan M Davis wrote:
> > On Tuesday, October 08, 2013 01:18:45 Walter Bright wrote:
> >> Because I often need to amend a pull request, and I was told it was done
> >>
> >> with:
> >> git --amend -a
> >> git push -f
> >>
> >> and I've been doing that successfully since I've been doing PR's.
> >
> > That's perfectly fine as long as it's to your branch (which it normally
> > would be for a PR). The problem is when it's done to master. However, I
> > didn't know that you could get away with doing a push without listing the
> > target branch. I always list the target branch, which is less
> > error-prone, since you're never going to push -f to master.
>
> I'm not really sure why that one time I did it it applied it to master
> rather than the branch. Anyhow, what is the syntax to apply it only to a
> branch?
Assuming that your github repo is named origin (which is normally the case),
it should be
git push origin branch-name
or for forcing it,
git push -f origin branch-name
and git will complain if you try and push it to a branch that doesn't have the
same name as your local one. So, it should catch any mismatch. And the only
reason that you'd risk pushing to the main repo that way is if you
accidentally typed upstream instead of origin, and you'd have to combine both
upstream and master to actually mess with master on the main repo (and since
pull requests really should be coming from branches, not master, the odds of
accidentally pushing to master on upstream should be quite low).
If you have to actually push to the main repo, then presumably it would be
git push upstream branch-name
or
git push -f upstream branch-name
though I'd generally expect you to only be pushing to upstream when creating
branches for releases and whatnot, not pull requests (I'm not sure that you
even _can_ create pull requests to the main repo from branches on the main
repo).
- Jonathan M Davis
More information about the dmd-internals
mailing list