I'm trying fast forward develop branch to the main as
git checkout main
git merge --ff develop
git push
but that for some reason creates merge commit which introduces a new hash
Then I have did that:
git merge --verbose --ff-only develop
which ended up with
fatal: Not possible to fast-forward, aborting.
Regular --ff came up as
Merge made by the 'recursive' strategy.
pom.xml | 2 +-
src/main/webapp/WEB-INF/web.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Any thoughts on that?
ffonly works if you are standing on an ancestor of the branch you are trying to merge:That would be ok (because
masteris on an ancestor ofdevelop)This would not work because now
masteris not on an ancestor ofdevelop.So..... why is
Gthere? I would not be able to know. You should be able to list that (or those) commit with this to be able to see what they are about:Now.... if you always intend to have
masteron top ofdevelop, there's more than one way to do it. The way you are attempting (git merge --ff-only) works if you are on an ancestor..... but if you always want it to work regardless of anything that you have committed inmaster(you don't care losing it if there's something at all), then you can do:Or
The first approach looks more efficient because the working tree is only being adjusted once whereas in the second it is twice (unless you are in master to start with).