GitHub & Betaflight



Open-source projects usually will utilize GitHub as the project repository and source code management functionality. GitHub is the largest open source community in the world, there are millions of open source projects on GitHub, including Betaflight.

To contribute or utilize the functionalities of GitHub it is recommended to create your own GitHub account. What i’m sharing in this blog is how to utilize GitHub and use Git Shell to fork an open source project, copy files into your computer, make an edit and synchronize your local files with your online repository.

  1. Download and install GitHub Desktop then open Git Shell.
  2. Make a new directory for Betaflight, open Git Shell and point the directory to the Betaflight directory.
    • eg.: cd D:\dev\betaflight
  3. Open and create a GitHub account and fork Betaflight into your own account.
  4. Download and clone your forked Betaflight project into the newly created local directory
    • git clone<your GitHub account name>/betaflight
      • the three Blue lines before the syntax shows that the branch matches the remote.
      • Green means the branch is ahead of its remote.
      • Red means the branch is behind its remote.
      • Yellow means the branch is both ahead of and behind its remote
    • Synchronized with remote repository

  5. Set Betaflight master as your remote repository. Remote repositories are version of your project that are hosted on the internet.
    • git remote add betaflight
  6. Verify the new remote repository that you’ve just specified for your fork.
    • git remote -v
    • Verity remote repository

  7. Now that you have created local cloned repository and set remote master Betaflight, you need to know how to synchronize files from your local repository with the online remote repository to keep it up-to-date.
    • fetch info from Betaflight remote to get all latest commits from it
    • git fetch betaflight
  8.  Force push your repository and update your local files with latest updates and commits from remote.
    • force push your new branch to rewrite history
    • git push --force
  9. If you make some edits and want to push your online repository with the latest updated code, you can make a commit and push it to your remote.
    • git commit -a --amend --edit
    • git push --force

Its seems much, but half of these steps are just done only once to initialize your local files with your remote repository. Basically you’ll just need to do edits to your codes and do a commit and push to synchronize your local repo to the remote repo that is hosted on the internet.


How to update your local files and synchronize with remote while keeping your own changes on top:

  • git stash # stash changes while you will be rebasing
  • git rebase betaflight/master # get new commits from betaflight/master
  • git push --force # push new commits to your remote
  • git stash pop # return your changes from stash

How to update your local files and synchronize with remote:

  • git fetch betaflight #fetch info from Betaflight remote
  • git reset --hard betaflight/master

EDIT: credit to Andrey Mironov for all the help regarding GitHub functions. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *