a. create two local diverging branches :
git init
git checkout -b master
echo aaa > a.txt && git add a.txt && git commit -m "first commit"
git checkout -b diverge
echo bbb > b.txt && git add b.txt && git commit -m "diverge: bbb"
echo ccc > c.txt && git add c.txt && git commit -m "diverge: ccc"
# return to 'master' branch (which is 2 commits behind 'left') :
git checkout master
echo ddd > d.txt && git add d.txt && git commit -m "master: ddd"
echo eee > e.txt && git add e.txt && git commit -m "master: eee"
# now 'master' and 'diverge' are two local branches, which diverge :
git log --oneline --graph diverge master
b. if you want a diverging remote, push the 'diverging' branch to origin as 'master' branch :
git push origin diverge:refs/heads/master
# you now have a 'origin/master' branch
# at the same time, set your local 'master' branch to track 'origin/master' :
git branch -u master origin/master
# now 'git status' on master should say 'ahead 2, behind 2'
git checkout master
git status
Other ways to create diverging histories :
create a master branch, push it to orgin, then run git rebase -i HEAD~3
for example, and edit or remove the first commit
create a master branch, push to origin, then git reset
your master branch to some commit in the past, and create new commits on master