Here are the commands I used from the master branch
git branch experiment
git checkout experiment
git commit .
git push -u origin experiment
git commit .
git checkout master
git merge experiment
git push -u origin master
git branch -d experiment
error: The branch 'experiment' is not fully merged.
Note Wording changed in response to the commments. Thanks @slekse
That is not an error, it is a warning. It means the branch you are about to delete contains commits that are not reachable from any of: its upstream branch, or HEAD (currently checked out revision). In other words, when you might lose commits¹.
In practice it means that you probably amended, rebased or filtered commits and they don't seem identical.
Therefore you could avoid the warning by checking out a branch that does contain the commits that you're about un-reference by deleting that other branch.²
You will want to verify that you in fact aren't missing any vital commits:
git log --graph --left-right --cherry-pick --oneline master...experiment
This will give you a list of any nonshared between the branches. In case you are curious, there might be a difference without
--cherry-pick and this difference could well be the reason for the warning you get:
Omit any commit that introduces the same change as another commit on the "other side" when the set of commits are limited with symmetric difference. For example, if you have two branches, A and B, a usual way to list all commits on only one side of them is with --left-right, like the example above in the description of that option. It however shows the commits that were cherry-picked from the other branch (for example, "3rd on b" may be cherry-picked from branch A). With this option, such pairs of commits are excluded from the output.
¹ they're really only garbage collected after a while, by default. Also, the
git-branch command does not check the revision tree of all branches. The warning is there to avoid obvious mistakes.
² (My preference here is to just force the deletion instead, but you might want to have the extra reassurance).