Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ee4j-build] git question



On Wed, Dec 5, 2018 at 10:32 AM Bill Shannon <bill.shannon@xxxxxxxxxx> wrote:
My question is how did the commit histories diverge?  (You can't really look at the current history because I've merged the branches.)  I synced the local with the remote by pulling everything from the remote, then I rebased the branch on top of the stuff pulled from the remote.

Branches always diverge, otherwise there is no point to having a branch. 
 

Why did rebase cause something to appear in the remote that prevented me from pushing to the remote?

Doesn't the rebase just add new commits on to the end the commit history from the remote?

No, rebase basically re-writes history (unless the branches could be fast forwarded). It will take the commits that are different on the branch you are on, and apply them on top of the base branch.

Rebase is really for updating a feature branch in your personal fork, its not something you should do on an authoritative branch as it will mess up the history and require a force push. 

If you want to move commits from one branch to another you should probably cherry-pick them.

Stuart
 


Tom Jenkinson wrote on 12/4/18 7:17 AM:
I believe it is because the commit histories have diverged:
For example, you can see that the #338 commit has a different SHA on both branches.

My understanding is that as soon as the commit histories are different (different SHA) then you can't push them back without a force push because you will be re-writing history. More concretely for your case you can see after your steps if you do:
`git commit -1`
The sha will be different to the one on your current master: a16edc5d6e65a102ff169caef1d7b21a3b416591
Trying to push that without the force flag leads to the error message you can see.

One option might be to cherry-pick the individual commits from the EE4J_8 branch that you need, of course you will need to take care to make sure you got them all.



On Mon, 3 Dec 2018 at 21:49, Bill Shannon <bill.shannon@xxxxxxxxxx> wrote:
Any git experts out there?  I've asked a few people locally but no one has
really been able to explain this to me.

What am I doing wrong here?

javaxmail@datsunx$ git tag -a 1.6.3
javaxmail@datsunx$ git push origin 1.6.3
Counting objects: 1, done.
Writing objects: 100% (1/1), 178 bytes | 178.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
To github.com:eclipse-ee4j/javamail.git
 * [new tag]         1.6.3 -> 1.6.3
javaxmail@datsunx$ git checkout master
Switched to branch 'master'
Your branch is behind 'origin/master' by 1 commit, and can be fast-forwarded.
  (use "git pull" to update your local branch)
javaxmail@datsunx$ git pull -r
Updating beab926..8388a02
Fast-forward
 mailapijar/pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Current branch master is up to date.
javaxmail@datsunx$ git rebase EE4J_8
First, rewinding head to replay your work on top of it...
javaxmail@datsunx$ git push
To github.com:eclipse-ee4j/javamail.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@xxxxxxxxxx:eclipse-ee4j/javamail.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

I don't understand why the git push is failing.

I updated the master branch, then rebased the EE4J_8 branch on top of it.
Shouldn't it be ready to push at that point?

$ git pull -r
First, rewinding head to replay your work on top of it...
Applying: https://github.com/eclipse-ee4j/javamail/issues/336 release job
Applying: Update to newest parent pom. (#341)
Applying: Switch to jakarta coordinates.
Applying: Update parent pom version and update JAF version.
Applying: Update documentation for the move to Eclipse - fix #348
Applying: JavaMail 1.6.3 Final Release.
Applying: Update dependency javax.mail -> jakarta.mail.
Applying: Change Java platform module system name to jakarta.mail.
Applying: Don't include a version in the OSGi javax.activation dependency

What was in the remote master that wasn't pulled the first time?
_______________________________________________
ee4j-build mailing list
ee4j-build@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ee4j-build

_______________________________________________
ee4j-build mailing list
ee4j-build@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ee4j-build

_______________________________________________
ee4j-build mailing list
ee4j-build@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://www.eclipse.org/mailman/listinfo/ee4j-build

Back to the top