-
Notifications
You must be signed in to change notification settings - Fork 11
Tip: How to make your own firmware and pull requests
Needed Tools:
- Git bash https://git-scm.com/downloads
- Notepad++ https://notepad-plus-plus.org/ //Editor and usefull to compare single files
- WinMerge http://winmerge.org/ //Compare multiple files and folders
Example: Fork a repository:
- Login in webbrowser with your Github account
- Open https://github.com/prusa3d/Prusa-Firmware in webbrowser
- Press fork
- Copy from "Clone or download" the url https://github.com/3d-gussner/Prusa-Firmware.git
- Open/start "git bash"
- cd d: // Your hard drive
- cd Github // Your path
- md Prusa-Firmware // Create folder
- git clone https://github.com/3d-gussner/Prusa-Firmware.git 9.a ls shows new folder Prusa-Firmware under /d/Github/Prusa-Firmware
- cd Prusa-Firmware 10.a Copy branch name "MK3" //branch name is shown between '()' 10.b cd .. 10.c mv Prusa-Firmware MK3
10.d ls MK3/
10.e cd MK3
-
git remote -v //shows all sources to fetch/push data origin https://github.com/3d-gussner/Prusa-Firmware.git (fetch) origin https://github.com/3d-gussner/Prusa-Firmware.git (push)
-
git remote add upstream https://github.com/prusa3d/Prusa-Firmware.git
-
git remote -v //Check remote again origin https://github.com/3d-gussner/Prusa-Firmware.git (fetch) origin https://github.com/3d-gussner/Prusa-Firmware.git (push) upstream https://github.com/prusa3d/Prusa-Firmware.git (fetch) upstream https://github.com/prusa3d/Prusa-Firmware.git (push)
-
git fetch --all get updates from all remotes
-
git show-branch -r --list
-
git add worktree -b MK2 ../MK2 //creates a new branch with own local folder
-
ls .. MK2/ MK3/
-
repeat step 16 for all branches you need
-
ls .. MK2/ MK25/ MK3/
Expamle: Create own branch to modify the code: Try to create branches for changes you want to do to an existing one. Don't change anything in the forked branch, makes it easier to keep your copy to be update with the upstream (original repository)
-
Open/start git bash
-
cd d:
-
cd Github/Prusa-Firmware/MK3
-
git worktree add -b MK3private_build ../MK3-private_build
-
ls .. MK2/ MK25/ MK3/ MK3-private_build/
-
cd ../MK3-private_build
Changing and testing code:
- git status //shows if something changed and has to be committed Created a Test.md file
On branch MK3-private_build Untracked files: (use "git add ..." to include in what will be committed)
Test.md
nothing added to commit but untracked files present (use "git add" to track)
-
git commit -a //Always comment your changes. If there are more changes you should try to commit changes sooner than later, and then continue with the next thing
-
git push --set-upstream origin MK3-private_build //to publish your local branch into your github repository first time
-
git push // If it is published
How to prepare a pull requests to original repository
Try to keep the pull request as simple as possible, meaning don't try to make a pull request including lot of differnt changes. Example: You found two bugs in the firmware, so create for each bug your own worktree. Fix one bug by changing and testing the code in its folder/branch. Publish this branch to your github and then create a pull request. Do the same for the 2nd one.
Chances are higher to get the pull request merged to original repository/branch if changes are limited. Complex/multiple PRs may not make it.
Update your branch: Make sure you are in the folder which is a copy of the orinial repository/branch
d/Github/Prusa-Firmware/MK3
git fetch --all
if there are changes you should merge them to your repository/branch
git merge upstream/MK3
git status
git push //Update your github repository/branch
use WinDir to compare d:\Github\Prusa-Firmware\MK3 with d:\Github\Prusa-Firmware\MK3-private_build
Merge changes from original to private_build: change to d/Github/Prusa-Firmware/MK3-private_build/ git merge MK3
or use the webbrowser Github to merge
It can be that you get "Can't automatically merge" as there are conflicts, then you have to review the code. Look for "======" in that file.