1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-12-04 18:07:38 +00:00
MarlinFirmware/buildroot/share/git
Scott Lahteine a18045a96a 🧑‍💻 Support files updates
2024-02-07 22:40:43 -06:00
..
firstpush 🧑‍💻 Fix and improve build_all_examples 2022-08-01 01:59:37 -05:00
ghpc Add 'ghpc' helper script 2019-05-27 21:06:43 -05:00
ghtp Allow 'ghtp' to set a specific remote 2020-08-21 16:22:57 -05:00
mfadd 🎨 Misc. formatting 2023-04-07 16:16:28 -05:00
mfclean Add'l CI/git script tweaks, fixes 2020-08-10 20:17:41 -05:00
mfconfig 🧑‍💻 Support files updates 2024-02-07 22:40:43 -06:00
mfdoc 🧑‍💻 Fix and improve build_all_examples 2022-08-01 01:59:37 -05:00
mffp 🔖 Moving to bugfix-2.1.x 2022-06-24 01:11:06 -05:00
mfhelp 🧑‍💻 Support files updates 2024-02-07 22:40:43 -06:00
mfinfo 🔨 Update mfinfo for 2.1.x 2022-12-16 14:08:52 -06:00
mfinit Tweak usage strings 2019-01-23 23:10:32 -06:00
mfnew 🐛 Fix mffp usage 2022-01-09 01:31:03 -06:00
mfpr 🧑‍💻 Fix and improve build_all_examples 2022-08-01 01:59:37 -05:00
mfprep 🔨 Update mfprep comment 2022-08-01 01:58:45 -05:00
mfpub 🧑‍💻 Fix and improve build_all_examples 2022-08-01 01:59:37 -05:00
mfqp 🔨 Update git helper scripts 2021-12-25 00:46:49 -06:00
mfrb 🔨 Update git helper scripts 2021-12-25 00:46:49 -06:00
mfup Tweak usage strings 2019-01-23 23:10:32 -06:00
README.md Add 'ghpc' helper script 2019-05-27 21:06:43 -05:00

Marlin Github Helper Scripts

Introduction

A Pull Request is often just the start of a longer process of patching and refining the code until it's ready to merge. In that process it's common to accumulate a lot of commits, some of which are non-functional. Before merging any PR, excess commits need to be "squashed" and sometimes rearranged or reworked to produce a well-packaged set of changes and keep the commit history relatively clean.

In addition, while a PR is being worked on other commits may be merged, leading to conflicts that need resolution. For this reason, it's a best practice to periodically refresh the PR so the working copy closely reflects the final merge into upstream MarlinFirmware.

Merge vs Rebase

If you plan to create PRs and work on them after submission I recommend not using Github Desktop to sync and merge. Use the command line instead. Github Desktop provides a "merge" option, but I've found that "git rebase" is much cleaner and easier to manage. Merge applies new work after your commits, which buries them deeper in the commit history and makes it hard to bring them together as a final packaged unit. Rebase helpfully moves your commits to the tip of the branch, ensuring that your commits are adapted to the current code. This makes it easier to keep revising the commits in-place.

The Scripts

The following scripts can be used on any system with a GNU environment to speed up the process of working with Marlin branches and submitting changes to the project.

Remotes

File Description
mfadd [user] Add and Fetch Remote - Add and fetch another user's Marlin fork. Optionally, check out one of their branches.
mfinit Init Working Copy - Create a remote named 'upstream' (for use by the other scripts) pointing to the 'MarlinFirmware' fork. This only needs to be used once. Newer versions of Github Desktop may create upstream on your behalf.

Branches

File Description
mfnew [branch] New Branch - Creates a new branch based on upstream/[PR-target]. All new work should start with this command.
mffp Fast Push - Push the HEAD or a commit ID to upstream immediately. Requires privileged access to the MarlinFirmware repo.
firstpush Push the current branch to 'origin' -your fork on Github- and set it to track 'origin'. The branch needs to reside on Github before you can use it to make a PR.

Making / Amending PRs

File Description
mfpr Pull Request - Open the Compare / Pull Request page on Github for the current branch.
mfrb Do a git rebase then git rebase -i of the current branch onto upstream/[PR-target]. Use this to edit your commits anytime.
mfqp Quick Patch - Commit all current changes as "patch", then do mfrb, followed by git push -f if no conflicts need resolution.

Documentation

File Description
mfdoc Build the documentation with Jekyll and preview it locally.
mfpub Build and publish the documentation to marlinfw.org.

Utilities

File Description
ghtp -[h/s] Set the protocol to use for all remotes. -h for HTTPS, -s for SSL.
ghpc [-f] Push current branch to 'origin' or to the remote indicated by the error.
mfinfo This utility script is used by the other scripts to get:
- The upstream project ('MarlinFirmware')
- the 'origin' project (i.e., your Github username),
- the repository name ('Marlin'),
- the PR target branch ('bugfix-1.1.x'), and
- the current branch (or the first command-line argument).

By itself, mfinfo simply prints these values to the console.
mfclean      Prune your merged and remotely-deleted branches.

Examples

For a demonstration of these scripts see the video Marlin Live - May 9 2019. There is also an old write-up at #3193.