I follow these steps:

I follow these steps after creating my github fork:

$ git clone https://github.com/acassis/incubator-nuttx

$ git remote add upstream [email protected]:apache/incubator-nuttx.git

$ git pull upstream master

$ git checkout -b upstream upstream/master

$ git push origin master

Then you can create branches:

$ git checkout -b newbranchfornewfeature

$ git push -u origin newbranchfornewfeature

/* do your modifications and commits */

Before submitting the new branch I do it:

$ git checkout upstream

$ git pull

/* Now my local upstream branch synced with mainline */

Let return to my branch and rebase it:

$ git checkout newbranchfornewfeature

$ git rebase upstream

Push the commits of my branch to my github:

$ git push

Using the github interface submit the new feature to NuttX mainline.