-
-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into haslinghuis-patch-1
- Loading branch information
Showing
54 changed files
with
11,591 additions
and
20,312 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,21 +6,21 @@ This document gives some instructions how to handle Git. First make a fork of th | |
Please contribute to this article to help others make git easier to use. | ||
|
||
## Clone your fork to your development machine. | ||
|
||
git clone https://github.com/yourname/betaflight.git | ||
|
||
``` | ||
git clone https://github.com/yourname/betaflight.git | ||
``` | ||
## Global configuration | ||
|
||
Please configure this to have the correct author in your commits | ||
|
||
git config --global user.name "Your Name" | ||
git config --global user.email "[email protected]" | ||
|
||
``` | ||
git config --global user.name "Your Name" | ||
git config --global user.email "[email protected]" | ||
``` | ||
If you omit to configure this you get a warning and have to use the following commands to rectify: | ||
|
||
git config --global --edit | ||
git commit --amend --reset-author | ||
|
||
``` | ||
git config --global --edit | ||
git commit --amend --reset-author | ||
``` | ||
## Recommended git global environment: | ||
|
||
# Windows: | ||
|
@@ -39,111 +39,112 @@ If you omit to configure this you get a warning and have to use the following co | |
git config --global help.autocorrect true | ||
|
||
## Setup remotes | ||
|
||
git remote add upstream https://github.com/betaflight/betaflight.git | ||
git remote -v | ||
|
||
``` | ||
git remote add upstream https://github.com/betaflight/betaflight.git | ||
git remote -v | ||
``` | ||
## Create a branch and start making changes | ||
|
||
git checkout -b branch | ||
|
||
``` | ||
git checkout -b branch | ||
``` | ||
## Stage files for commit | ||
|
||
Commit your changes after making initial changes: | ||
|
||
git add . | ||
git commit -m "message" | ||
git push origin branch | ||
|
||
``` | ||
git add . | ||
git commit -m "message" | ||
git push origin branch | ||
``` | ||
Note: `git commit -am` or specify the files. | ||
|
||
## Make more changes and commit on top of last commit | ||
|
||
git commit --amend | ||
git push origin +branch | ||
|
||
``` | ||
git commit --amend | ||
git push origin +branch | ||
``` | ||
## Update master branch with upstream updates and update your fork | ||
|
||
git checkout master | ||
git pull --rebase upstream master | ||
git push origin +master | ||
|
||
``` | ||
git checkout master | ||
git pull --rebase upstream master | ||
git push origin +master | ||
``` | ||
## Update your local branch with upstream changes | ||
|
||
git checkout branch | ||
git branch --set-upstream-to=upstream/master branch | ||
git pull --rebase | ||
|
||
``` | ||
git checkout branch | ||
git branch --set-upstream-to=upstream/master branch | ||
git pull --rebase | ||
``` | ||
or | ||
|
||
git pull upstream master | ||
git rebase -i master | ||
|
||
``` | ||
git pull upstream master | ||
git rebase -i master | ||
``` | ||
If you look at `git reflog --oneline` you will see these lines: | ||
|
||
shacode HEAD@{0}: rebase (finish): returning to refs/head/branch | ||
shacode HEAD@{1}: rebase (pick): your branch commit description | ||
shacode (upstream/master, origin/master, origin/HEAD, master) HEAD@{2}: rebase (start): checkout longsha | ||
|
||
``` | ||
shacode HEAD@{0}: rebase (finish): returning to refs/head/branch | ||
shacode HEAD@{1}: rebase (pick): your branch commit description | ||
shacode (upstream/master, origin/master, origin/HEAD, master) HEAD@{2}: rebase (start): checkout longsha | ||
``` | ||
## Unstage file from working area | ||
|
||
git restore --staged <file> to unstage a file from working area. | ||
``` | ||
git restore --staged \<file> to unstage a file from working area. | ||
``` | ||
|
||
or | ||
|
||
git checkout --<filename> | ||
|
||
``` | ||
git checkout --\<filename> | ||
``` | ||
## Recover from unwanted commit without push | ||
|
||
git reset HEAD^ | ||
|
||
``` | ||
git reset HEAD^ | ||
``` | ||
## If you want to completely remove the unstaged changes run | ||
|
||
git reset --hard HEAD | ||
|
||
``` | ||
git reset --hard HEAD | ||
``` | ||
## Unwanted commits in your latest push. | ||
|
||
First try: | ||
|
||
git rebase -i origin/branch~2 branch | ||
git push origin +branch | ||
|
||
``` | ||
git rebase -i origin/branch~2 branch | ||
git push origin +branch | ||
``` | ||
If this fails, backup your changed files (maybe also could use git stash) | ||
|
||
git reset HEAD~ --hard | ||
git checkout branch | ||
|
||
``` | ||
git reset HEAD~ --hard | ||
git checkout branch | ||
``` | ||
And restore your saved files (or use git stash pop) | ||
|
||
git add . | ||
git commit -m "Make new commit" | ||
git push origin +branch | ||
|
||
``` | ||
git add . | ||
git commit -m "Make new commit" | ||
git push origin +branch | ||
``` | ||
## See general changes | ||
|
||
git diff | ||
|
||
``` | ||
git diff | ||
``` | ||
## See changes in particular file | ||
|
||
git log -- src/main/cms/cms` .c | ||
|
||
``` | ||
git log -- src/main/cms/cms` .c | ||
``` | ||
## Checkout work on another machine | ||
|
||
git checkout origin/branch | ||
git switch -c branch | ||
|
||
``` | ||
git checkout origin/branch | ||
git switch -c branch | ||
``` | ||
## Quickly testing a PR | ||
|
||
git fetch upstream pull/2500/head:2500 | ||
git checkout 2500 | ||
|
||
``` | ||
git fetch upstream pull/2500/head:2500 | ||
git checkout 2500 | ||
``` | ||
## Squash your commits | ||
|
||
From the project folder you can use somethink like: https://www.scraggo.com/how-to-squash-commits. | ||
Note the number of commits in your PR. | ||
|
||
git rebase -i HEAD~17 | ||
|
||
``` | ||
git rebase -i HEAD~17 | ||
``` | ||
- You should see a list of commits, each commit starting with the word “pick”. | ||
- Make sure the topmost, first commit says “pick” and change the rest below from “pick” to “squash”. This will squash each commit into the previous commit, which will continue until every commit is squashed into the first commit. | ||
- Save and close the editor. | ||
|
@@ -152,24 +153,24 @@ Note the number of commits in your PR. | |
- Important: If you’ve already pushed commits to origin, and then squash them locally, you will have to force the push to your branch. | ||
|
||
Finally update with: | ||
|
||
git push origin +branch | ||
|
||
``` | ||
git push origin +branch | ||
``` | ||
## Commit to a PR from another contributor | ||
|
||
Sometimes you want to make changes to an existing PR. | ||
Before doing so please ask permission from the contributor. | ||
In the example please substitute the contributor, betaflight_project and branch: | ||
|
||
git remote add contributor https://github.com/contributor/betaflight_project.git | ||
git remote -v | ||
git fetch contributor | ||
git switch branch | ||
|
||
``` | ||
git remote add contributor https://github.com/contributor/betaflight_project.git | ||
git remote -v | ||
git fetch contributor | ||
git switch branch | ||
``` | ||
The original author now can pull the changes to the local branch with: | ||
|
||
git fetch origin branch:branch --update-head-ok | ||
|
||
``` | ||
git fetch origin branch:branch --update-head-ok | ||
``` | ||
Now you can make more changes and commit again. (This should just work with git pull - have to check this) | ||
|
||
# Advanced | ||
|
@@ -183,20 +184,20 @@ When using commit just add the -S flag to verify the commit and enter the passph | |
## Bisection | ||
|
||
Do bisection: | ||
|
||
git bisect reset | ||
git bisect start | ||
git checkout 4.1.1 | ||
|
||
``` | ||
git bisect reset | ||
git bisect start | ||
git checkout 4.1.1 | ||
``` | ||
Build and make sure it works | ||
|
||
git bisect good | ||
git checkout 4.1.2 | ||
|
||
``` | ||
git bisect good | ||
git checkout 4.1.2 | ||
``` | ||
Build and make sure it fails | ||
|
||
git bisect bad | ||
|
||
``` | ||
git bisect bad | ||
``` | ||
Then git will automatically bisects commits between the two versions, checks out a new bisecting commit. | ||
You will build and test it, and tell git if the commit was good or bad. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,52 @@ | ||
# Building in Fedora 35 | ||
|
||
$ sudo dnf check-update | ||
$ sudo dnf install git clang libblocksruntime-devel | ||
$ sudo dnf group install "C Development Tools and Libraries" | ||
$ git clone https://github.com/betaflight/betaflight.git | ||
$ cd betaflight | ||
$ make arm_sdk_install | ||
$ make configs | ||
$ make TARGET=MATEKF411 | ||
|
||
``` | ||
$ sudo dnf check-update | ||
$ sudo dnf install git clang libblocksruntime-devel | ||
$ sudo dnf group install "C Development Tools and Libraries" | ||
$ git clone https://github.com/betaflight/betaflight.git | ||
$ cd betaflight | ||
$ make arm_sdk_install | ||
$ make configs | ||
$ make TARGET=MATEKF411 | ||
``` | ||
### Building Configurator in Fedora 35 | ||
|
||
$ sudo dnf check-update | ||
$ sudo dnf install libatomic rpm-build dpkg | ||
$ sudo dnf module list nodejs | ||
$ sudo dnf module install nodejs:14/default | ||
$ sudo npm install -g gulp-cli yarn | ||
$ yarn install | ||
$ yarn gulp debug | ||
|
||
``` | ||
$ sudo dnf check-update | ||
$ sudo dnf install libatomic rpm-build dpkg | ||
$ sudo dnf module list nodejs | ||
$ sudo dnf module install nodejs:14/default | ||
$ sudo npm install -g gulp-cli yarn | ||
$ yarn install | ||
$ yarn gulp debug | ||
``` | ||
Note: Please check this link for the required Node version: https://github.com/betaflight/betaflight-configurator#development | ||
|
||
### Serial permissions | ||
|
||
Remove ModemManager. | ||
Add yourself to the dialout group: | ||
|
||
$ sudo dnf remove ModemManager | ||
$ sudo usermod -aG dialout $(whoami) | ||
``` | ||
$ sudo dnf remove ModemManager | ||
$ sudo usermod -aG dialout $(whoami) | ||
`````` | ||
Save and reboot after adding the following contents: | ||
``` | ||
$ sudo nano /etc/udev/rules.d/45-stdfu-permissions.rules | ||
|
||
$ sudo nano /etc/udev/rules.d/45-stdfu-permissions.rules | ||
|
||
# Notify ModemManager this device should be ignored | ||
ACTION!="add|change|move", GOTO="mm_usb_device_blacklist_end" | ||
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end" | ||
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end" | ||
# Notify ModemManager this device should be ignored | ||
ACTION!="add|change|move", GOTO="mm_usb_device_blacklist_end" | ||
SUBSYSTEM!="usb", GOTO="mm_usb_device_blacklist_end" | ||
ENV{DEVTYPE}!="usb_device", GOTO="mm_usb_device_blacklist_end" | ||
|
||
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1" | ||
ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1" | ||
ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1" | ||
ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", ENV{ID_MM_DEVICE_IGNORE}="1" | ||
|
||
LABEL="mm_usb_device_blacklist_end" | ||
LABEL="mm_usb_device_blacklist_end" | ||
|
||
#STM32 DFU Access | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" | ||
#AT32 DFU Access | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", TAG+="uaccess" | ||
#STM32 DFU Access | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", TAG+="uaccess" | ||
#AT32 DFU Access | ||
SUBSYSTEM=="usb", ATTRS{idVendor}=="2e3c", ATTRS{idProduct}=="df11", TAG+="uaccess" | ||
``` |
Oops, something went wrong.