Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » push new local branch to remote repo
push new local branch to remote repo [message #783004] Tue, 24 January 2012 22:15 Go to next message
Stefan Nöbauer is currently offline Stefan NöbauerFriend
Messages: 20
Registered: January 2012
Junior Member
Hi ... Im very new to Git/EGit.
I setup a remote repo with gerrit. After creating the master branch I created a develop branch based on the master. These two branches also exists on the remote repo.
Then I created a feature branch. I got a local branch. After changeing code, submitting locally I tried to push this branch to the remote Repo.

index.php/fa/6866/0/

This is not working / or I am doing something wrong.

I used following push configuration:

HEAD:refs/for/Feature_1


The push dialog tells me: branch Feature_1 not found

What am I doing wrong?
  • Attachment: branches.png
    (Size: 6.80KB, Downloaded 11964 times)
Re: push new local branch to remote repo [message #783223 is a reply to message #783004] Wed, 25 January 2012 10:06 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
If you want to create a branch on the server either do it from Gerrit admin ui on the project
at http://your.gerrit.server/r/#/admin/projects/yourproject,branches
or directly push to refs/heads/Feature_1 (this requires push permission on refs/heads/*).

Creating a feature branch on Gerrit server is usually done for bigger features which
require collaboration between different developers. Alternatively you may consider
to use patch series, though this is a bit more tricky to maintain as often this requires
using rebase interactive to update the series.

For single changes you don't need to explicitly create server side branches as they
are kept on a virtual branch managed by Gerrit until the change gets accepted in
the code review process.
Re: push new local branch to remote repo [message #783243 is a reply to message #783223] Wed, 25 January 2012 10:45 Go to previous messageGo to next message
Stefan Nöbauer is currently offline Stefan NöbauerFriend
Messages: 20
Registered: January 2012
Junior Member
Quote:
or directly push to refs/heads/Feature_1 (this requires push permission on refs/heads/*).


This is not creating the Branch on the remote repo. Should it? I can not find any? So where did that push to?


Quote:
For single changes you don't need to explicitly create server side branches as they
are kept on a virtual branch managed by Gerrit until the change gets accepted in
the code review process.

Which refs configuration do i have to use to push to the Gerrit Review? As I saw an the Exercise 2: Develop a feature from the Userguide they pushed the feature branch into the master. Isn`t that already a merge?


I do have one more question about the usability of EGit.
Is there a better way to configure the Push refs?

  • Scenario 1
    I switched to Branch develop. After making changes, submitting locally, I would like to push to the remote. To do that I have to change my Push Configuration to HEAD:refs/for/develop.
  • Scenario 2
    I swiched to a feature branch Feature_1. Again made changes, submitted locally. Now I would like to push to the remote feature branch (I already created that branch). To do so I have again to change the Push Configuration to HEAD:refs/for/Feature_1.


Isn`t there a way to save this kind of configurations? Or am I totally misunderstanding the usage of EGit?

[Updated on: Wed, 25 January 2012 19:20]

Report message to a moderator

Re: push new local branch to remote repo [message #784704 is a reply to message #783243] Fri, 27 January 2012 22:32 Go to previous messageGo to next message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
If you want to push to Gerrit for code review to alternating branches
you may configure multiple remotes:

e.g. the remotes I use for jgit:

[remote "origin"]
url = http://egit.eclipse.org/jgit.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/notes/review:refs/notes/review
pushurl = http://egit.eclipse.org/jgit.git
push = HEAD:refs/for/master

[remote "stable-1.3"]
pushurl = http://egit.eclipse.org/jgit.git
push = HEAD:refs/for/stable-1.3

So if I click "push" on the push entry under remote "origin"
I push my change to refs/for/master so that the change
gets accepted into master. If I click "push" on remote "stable-1.3"
the change goes into the review queue for the stable-1.3
branch.
Re: push new local branch to remote repo [message #784987 is a reply to message #784704] Sat, 28 January 2012 08:47 Go to previous messageGo to next message
Stefan Nöbauer is currently offline Stefan NöbauerFriend
Messages: 20
Registered: January 2012
Junior Member
Thanx very much!!!!! Is it possible to pre configure that on the remote repo?
Re: push new local branch to remote repo [message #788964 is a reply to message #784987] Thu, 02 February 2012 12:49 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 1268
Registered: July 2009
Senior Member
This is a local configuration on the receiving end. I think you can't configure that on the server side. AFAIK the reason why git doesn't transport configurations is to protect you against remote git repositories run by some bad guys which might try to compromise your system.
Previous Topic:branch.master.rebase true not working sometimes
Next Topic:Hooks for EGit
Goto Forum:
  


Current Time: Fri Apr 19 20:57:16 GMT 2024

Powered by FUDForum. Page generated in 0.02892 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top