[dmd-internals] Git question: How do I push a *single* branch?
Don Clugston
dclugston at googlemail.com
Mon Nov 21 02:31:50 PST 2011
On 21 November 2011 10:12, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Monday, November 21, 2011 10:01:30 Don Clugston wrote:
>> In my local repository I have two branches, branch1 and branch2.
>> I publish branch1 to github:
>> git push origin : branch1
>> A side-effect of this, is that it automatically makes branch1 a remote
>> tracking branch.
>>
>> Now, I add an extra commit to branch1, but I don't want to push it yet.
>> But I do want to push branch2.
>> So I type: git push origin : branch2
>> This creates branch2, BUT it also pushes branch1 as well!
>> How do I stop this?
>>
>> I can't see anything in the manual for git push that explains this.
>> How can I push branch2 *only* ?
>
> I would do
>
> git-push origin branch1
>
> That only pushes branch1 regardless of what's going on in other branches. It
> creates the branch in origin if it doesn't exist there and updates it
> otherwise. You then _remove_ a branch in origin by doing
>
> git-push origin :branch1
>
> So, I'm surprised that
>
> git-push origin : branch1
>
> isn't deleting branch1 in origin. I guess that the space makes all the
> difference. I'd have to go digging throught Pro Git and the like to know what
>
> git-push origin : branch1
>
> is really doing.
Thanks, you're right!
Turns out that " : " (with spaces) means "push everything".
So:
git push origin : branch1 ---> push everything. The "branch1"
argument is irrelevant, except that it must exist locally
git push origin:branch1 --> (this is an error)
git push origin origin:branch1 --> push currently active branch to
remote branch1, which must already exist.
git push origin :branch1 ---> delete remote branch1
git remote rm branch1 ---> delete config section remote.branch1
git branch rm branch1 ---> copy branch1 to new branch called 'rm'
Use --force to make a git command do something that may cause loss of
information, except for git branch, where you convert the option to
uppercase instead.
More information about the dmd-internals
mailing list