Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I create a proper new local and remote branch combination in EGit?

Tags:

git

egit

I would like to do the following in EGit:

$ git checkout -b newbranch
$ git push -u origin newbranch

This gives me a new local branch, pushes it to the upstream server and creates the right tracking reference. How do I do the same in EGit?

like image 490
neelance Avatar asked Apr 11 '12 17:04

neelance


1 Answers

For the first operation, you can read the EGit manual "Creating a New Local Branch "

Select Team > Switch To... > New Branch

new branch dialog

For the push, see Vogella's Egit tutorial, but also the "Push ref specification"

push a branch

Note: robinst has opened bug 378960 "Allow to configure upstream in Push Branch wizard" (mentioned in "EGit - set up remote tracking correctly when creating a branch").

The problem is that this (configuring the upstream on push) is not yet done automatically when first pushing a branch.

For now you have to right click on the branch in the Git Repositories view and choose "Configure Branch", where you can set up the upstream configuration.


Note: bug 378960 has been marked as resolved (February 2014) in Egit 3.2:

Push Branch / Initial Push wizard simplifies pushing a branch and also allows upstream configuration for new branches created by the push operation:

https://wiki.eclipse.org/images/6/6f/Egit-3.2-PushBranchWizard.png

like image 189
VonC Avatar answered Oct 07 '22 23:10

VonC