non-fast-forward error after release and new feature push

635 views
Skip to first unread message

Lars Fischer

unread,
Mar 7, 2012, 4:58:42 AM3/7/12
to gitflo...@googlegroups.com
Hello,

I started playing with git and gitflow and have some trouble when performing a release.

This is what I use:
- one external git repo for origin
- a local repo on my machine, where I do development changes
- a ci-server, which performs the release steps

This is what I do local:
- clone the repo to my local machine
- call "git flow init -d"
- perform some developments using the git flow feature commands (no feature publishing)
- push the commits on the develop branch to origin

This is what I perform during a release on the ci-server:
- clone the repo to the ci machine
- call "git flow init -d"
- start the release: "git flow release start VERSIONX"
- correct some build settings to final values and commit these changes to the release branch
- finish the release: "git flow release finish -F -m 'VERSIONX' VERSIONX"
- correct some build settings to next dev-values and commit these changes to the develop branch

After this, the first release was successful and I do the next development round. For this, I perform a "git pull" on the developer machines develop branch.
I retrieve the release merges and changes and do start new feature changes.

But now my problem startes:
trying to push the second development committs on the develop branch from my developer maching to origin,
I get this git error:

d:\dev\projects\reschif\source\testrepo>git push
Counting objects: 12, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (10/10), done.
Writing objects: 100% (10/10), 882 bytes, done.
Total 10 (delta 8), reused 0 (delta 0)
remote: bb/acl: reschifl is allowed. accepted payload.
To g...@bitbucket.org:reschifl/testrepo.git
   2676d4f..7946595  develop -> develop
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'g...@bitbucket.org:reschifl/testrepo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

Where is my mistake? What will I have to do, to prevent this error after performing a release on the ci-server?
I also tried the mentioned "git pull" before the push, but the error is the same.

Regards,
Lars

Mark Derricutt

unread,
Mar 7, 2012, 5:14:40 AM3/7/12
to gitflo...@googlegroups.com
After you do 'git flow release finish…' are you 'git pushing' back to your origin both the develop, and master branches?


-- 
Mark Derricutt
Sent with Sparrow

Lars Fischer

unread,
Mar 7, 2012, 5:47:31 AM3/7/12
to gitflo...@googlegroups.com
Hello Mark,

thank you for your quick response.


Mark Derricutt:
After you do 'git flow release finish…' are you 'git pushing' back to your origin both the develop, and master branches?

After "git flow release finish...", the current branch is develop. There I do some build value changes and commit these.

Than I simply call "git push" on this develop branch, which results in a log like this:

+ git commit -a -m Start development version 0.0.18-SNAPSHOT
[develop 2676d4f] Start development version 0.0.18-SNAPSHOT
 1 files changed, 1 insertions(+), 1 deletions(-)
+ git push
remote: bb/acl: reschifl is allowed. accepted payload. [K
To g...@bitbucket.org:reschifl/testrepo.git
   dae6478..2676d4f  develop -> develop
   4199e60..ea75e99  master -> master
+ git push --tags
remote: bb/acl: reschifl is allowed. accepted payload. [K
To g...@bitbucket.org:reschifl/testrepo.git
 * [new tag]         0.0.17 -> 0.0.17


I think this means, that both branches master and develop were pushed.
Do I have to use different push options?

Regards,
Lars

Mark Derricutt

unread,
Mar 7, 2012, 5:57:45 AM3/7/12
to gitflo...@googlegroups.com
Hrm - that all looks like it should be good then.  I was thinking maybe you were ONLY pushing develop and not master.

Does the problem also occur if you manually do a release from a local machine, rather than the CI box?

*ponders* Just thinking, I have seem something similar to this at work when a coworker does a release ( we do releases on dev machines, rather than CI - personally I find that madness as commits can sneak in ).

On the dev machine, when I go "git pull", that does a fetch and then a merge from origin/develop to my local develop, however origin/master doesn't been merged ( upstreams origin/master has been pulled into my local repo, but its not in my master branch yet ) so in those cases I have to switch to my master branch and git pull there as well.

If this is the case, then this is more a git question than git-flow itself, I just found a good article on the differences between pull and fetch that might be good reading:


THe short is - a pull simply merges the CURRENT branch with its tracking branch, not the other branches.

-- 
Mark Derricutt
Sent with Sparrow

Lars Fischer

unread,
Mar 7, 2012, 6:42:13 AM3/7/12
to gitflo...@googlegroups.com
2012/3/7 Mark Derricutt <ma...@talios.com>:

> Does the problem also occur if you manually do a release from a local
> machine, rather than the CI box?

When performing the release on my local machine, I don't see this effect.


> On the dev machine, when I go "git pull", that does a fetch and then a merge
> from origin/develop to my local develop, however origin/master doesn't been
> merged ( upstreams origin/master has been pulled into my local repo, but its
> not in my master branch yet ) so in those cases I have to switch to my
> master branch and git pull there as well.

I think I do not fully understand, what a "non-fast-forward" error is
about, but this could be the key information.


The release on the ci-server changes the master branch.
A "git pull" on my local develop branch shows, that there are changes
retrieved from origin for all branches:

> d:\dev\projects\reschif\source\testrepo>git status
> # On branch develop
> nothing to commit (working directory clean)
>
> d:\dev\projects\reschif\source\testrepo>git pull
> remote: Counting objects: 14, done.
> remote: Compressing objects: 100% (10/10), done.
> remote: Total 10 (delta 6), reused 0 (delta 0)
> Unpacking objects: 100% (10/10), done.
> From bitbucket.org:reschifl/testrepo
> 91e6a05..4ad9f80 develop -> origin/develop
> ea75e99..a3c4724 master -> origin/master
> * [new tag] 0.0.18 -> 0.0.18
> Updating 91e6a05..4ad9f80
> Fast-forward
> pom.xml | 2 +-


> 1 files changed, 1 insertions(+), 1 deletions(-)

But it also shows that the committs on develop are merged. ("Fast-foreward...").


I don't know, if incomming changes on the master branch, which is not
checked out, also need to be merged.

> d:\dev\projects\reschif\source\testrepo>git checkout master
> Switched to branch 'master'
> Your branch is behind 'origin/master' by 10 commits, and can be fast-forwarded.
>
> d:\dev\projects\reschif\source\testrepo>git merge
> fatal: No commit specified and merge.defaultToUpstream not set.
>
> d:\dev\projects\reschif\source\testrepo>git pull
> Updating ea75e99..a3c4724
> Fast-forward
> pom.xml | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)

I don't know how to call the merge on master, but a pull also worked :)


> If this is the case, then this is more a git question than git-flow itself,
> I just found a good article on the differences between pull and fetch that
> might be good reading:
>
> http://longair.net/blog/2009/04/16/git-fetch-and-merge/
>
> THe short is - a pull simply merges the CURRENT branch with its tracking
> branch, not the other branches.

Thank you for this info and the link.
For me, it looks like that this error is an expected behaviour.
So, I have to learn more about git.


Best regards,
Lars

Aseem Kishore

unread,
Mar 7, 2012, 9:42:49 AM3/7/12
to gitflo...@googlegroups.com, gitflo...@googlegroups.com
Yes this error is merely:

- "git push" pushes all branches;
- but your master is outdated;
- so git won't let you push master.

Your options are:

- "git pull origin develop" only;
- "git pull"; "git co master"; "git pull" again (or just "git merge origin/master"); "git co develop"
- or just ignore the error! It doesn't affect you until/unless you actually want to use master.

:)

Aseem

Lars Fischer

unread,
Mar 8, 2012, 4:22:32 AM3/8/12
to gitflo...@googlegroups.com
Hello Aseem,

2012/3/7 Aseem Kishore <aseem....@gmail.com>:


> Yes this error is merely:
>
> - "git push" pushes all branches;
> - but your master is outdated;
> - so git won't let you push master.

Thank you for the explanation.


> Your options are:
>
> - "git pull origin develop" only;
> - "git pull"; "git co master"; "git pull" again (or just "git merge origin/master");  "git co develop"
> - or just ignore the error! It doesn't affect you until/unless you actually want to use master.

I think I will use them all in this order... ;)


Regards,
Lars

Reply all
Reply to author
Forward
0 new messages