Skip to main content



      Home
Home » Eclipse Projects » EGit / JGit » Behavior changed when pushing a new branch?
Behavior changed when pushing a new branch? [message #1856059] Thu, 17 November 2022 12:31 Go to next message
Eclipse UserFriend
Hi

I'm pretty sure that a few versions ago (maybe two Eclipse distributions ago?) when I created a new local branch and I pushed that to the remote, Egit would push it to a new remote branch with the same name of the newly created branch.

This does not happen anymore. This way, it happens quite often that I create a new branch locally and when I push it I push it to the remote master.

How could I restore the old behavior?

thanks in advance
Re: Behavior changed when pushing a new branch? [message #1856060 is a reply to message #1856059] Thu, 17 November 2022 13:57 Go to previous messageGo to next message
Eclipse UserFriend
I think you'll need to detail exactly what you're doing. I create local branches quite often, and they map to the remote with a branch of the same name.
Re: Behavior changed when pushing a new branch? [message #1856064 is a reply to message #1856060] Fri, 18 November 2022 02:58 Go to previous messageGo to next message
Eclipse UserFriend
David, I'm not doing anything special. Let's say I'm on the master branch, from Eclipse I create a new branch, say "experiments", and switch to that branch. I create a commit on "experiments" and then I push: it pushes "experiments" to "master", instead of pushing on a new remote branch "experiments". This has been happening since a few versions ago. I should have reported earlier but I forgot I'm afraid. Before, it used to push to a new remote branch "experiments"

Maybe I should somehow update my git configuration? But I haven't changed anything in that respect, and it happens with all my Git repositories.
Re: Behavior changed when pushing a new branch? [message #1856267 is a reply to message #1856064] Wed, 30 November 2022 04:24 Go to previous messageGo to next message
Eclipse UserFriend
There have been changes in the push implementation in EGit, yes. But they should not have changed that, I think.

How exactly do you create the branch, and how exactly do you push? Which menu command or button do you use? How does the branch configuration in .git/config for that new branch look, and how does the remote config look?
Re: Behavior changed when pushing a new branch? [message #1856275 is a reply to message #1856267] Wed, 30 November 2022 11:14 Go to previous messageGo to next message
Eclipse UserFriend
Let's say I'm on the master branch. From the "History" view I right-click and select "Create Branch..." (I also select to checkout the new branch). If I then push the branch, e.g., with "Push Head..." from the "Staging" view or from the "Git Repositories" view ("Push <name of the branch>...") the dialog, by default, proposes to push to the "master" branch.

The config looks like that

[branch "<name of new branch>"]
	remote = origin
	merge = refs/heads/<name of new branch>
	rebase = false


So there's no push configuration
Re: Behavior changed when pushing a new branch? [message #1856306 is a reply to message #1856275] Thu, 01 December 2022 16:25 Go to previous messageGo to next message
Eclipse UserFriend
I cannot reproduce this. Could you show the remote config for origin, please? (The [remote "origin"] section in .git/config.)
Re: Behavior changed when pushing a new branch? [message #1856307 is a reply to message #1856306] Thu, 01 December 2022 16:45 Go to previous messageGo to next message
Eclipse UserFriend
Here's an example (but I experience the same in all my cloned repos)

[remote "origin"]
	url = git@github.com:eclipse-emf-parsley/emf-parsley.git
	fetch = +refs/heads/*:refs/remotes/origin/*
Re: Behavior changed when pushing a new branch? [message #1856327 is a reply to message #1856307] Sat, 03 December 2022 07:24 Go to previous messageGo to next message
Eclipse UserFriend
No idea. I don't see anything in the code that would cause this, and I cannot reproduce this. This would need debugging with your exact setup to figure out what's going on. (I tried with the "Push Branch 'xxx'... dialog. That would be org.eclipse.egit.internal.ui.push.PushBranchPage.)
Re: Behavior changed when pushing a new branch? [message #1856328 is a reply to message #1856327] Sat, 03 December 2022 07:31 Go to previous messageGo to next message
Eclipse UserFriend
What could be special in my setup? This happens with all my repositories.. what's the exact git config in your case?
Could it be due to the fact I clone my repos from the command line?
Should I have specific push configuration?
Re: Behavior changed when pushing a new branch? [message #1856341 is a reply to message #1856328] Mon, 05 December 2022 02:07 Go to previous messageGo to next message
Eclipse UserFriend
Lorenzo Bettini wrote on Sat, 03 December 2022 12:31
What could be special in my setup?

I don't know. Which is why I wrote this would need debugging.
Quote:
This happens with all my repositories.. what's the exact git config in your case?

Same as yours, nothing special.
Quote:
Could it be due to the fact I clone my repos from the command line?

Maybe. I doubt it, but I don't know.
Quote:
Should I have specific push configuration?

No. What you've shown looks perfectly normal and should work. (And does work for me.)
Re: Behavior changed when pushing a new branch? [message #1856645 is a reply to message #1856341] Tue, 20 December 2022 12:40 Go to previous messageGo to next message
Eclipse UserFriend
I'll try to summarize the steps that reproduce my problem. (I get the same problem both on Linux, macOS and Windows):

Downloaded the Eclipse distribution for Java developers

- on a brand new workspace I "Import from Git",
- I clone this repository https://github.com/LorenzoBettini/maven-bank-example selecting only "master"
- imported from the cloned repo the single project
- from the git history I right-click on the "master" branch and create a new branch "example" (leaving all the defaults)

Screenshot:
https://ibb.co/nbkJnKw

- on the "Git Repositories" view I right click and select "Push Branch 'example'"

Screenshot:
https://ibb.co/zXf6R6y

- and it proposes to push to "master" INSTEAD OF "example"

Screenshot:
https://ibb.co/mcycWC4

- having a look at the configuration in the Git preferences the "example" branch is set to merge with "master"

Screenshot:
https://ibb.co/xhsf20F

This drives me mad... what am I doing wrong?

[Updated on: Tue, 20 December 2022 12:41] by Moderator

Re: Behavior changed when pushing a new branch? [message #1856674 is a reply to message #1856645] Thu, 22 December 2022 02:01 Go to previous messageGo to next message
Eclipse UserFriend
Uncheck "Configure upstream branch for push and pull".
Re: Behavior changed when pushing a new branch? [message #1856677 is a reply to message #1856674] Thu, 22 December 2022 03:37 Go to previous messageGo to next message
Eclipse UserFriend
Thanks!
I was about to answer myself because I had found out that myself.
Maybe I'm picky, but that shows that the default behavior HAS changed...
Re: Behavior changed when pushing a new branch? [message #1856691 is a reply to message #1856677] Thu, 22 December 2022 17:51 Go to previous message
Eclipse UserFriend
At least neither the behavior of that checkbox nor the "Push branch 'xxx'" behavior seems to have changed. I just discovered that I still had an age-old Eclipse with an age-old EGit around, and surprisingly it even still started: I see the exact same behavior in EGit 4.10 as in EGit 6.2 or EGit nightly. I also see no recent code changes in that dialog or in the component for that checkbox. ("Recent" meaning within the past three years).

If there is a change, I must have a blind spot.
Previous Topic:Discussion on default values of "Configure upstream for push and pull"
Next Topic:Exit from Eclipse Git
Goto Forum:
  


Current Time: Sun May 18 16:21:34 EDT 2025

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

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

Back to the top