This repository has been archived on 2022-01-28. You can view files and clone it, but cannot push or open issues or pull requests.
Marlin-Artillery-M600/buildroot/share/git
2017-05-05 13:32:31 -05:00
..
firstpush Update "firstpush" to open branch commits on Github 2017-04-14 19:06:31 -05:00
ghtp Add ghtp script to set remotes to HTTP or SSL 2016-06-16 12:56:39 -07:00
mfadd New git helper scripts 'mfadd' and 'mfqp' 2017-04-20 21:37:25 -05:00
mfclean Tweak git helper scripts 2017-05-05 13:32:31 -05:00
mfdoc Add 'mfdoc' and 'mfpub' scripts to help with documentation 2017-04-20 21:37:26 -05:00
mfinfo bugfix-1.1.x ReadMe, Version, helper scripts 2017-05-04 07:17:10 -05:00
mfinit Improve existing git helper scripts 2017-04-20 21:37:25 -05:00
mfnew Tweak git helper scripts 2017-05-05 13:32:31 -05:00
mfpr Improve existing git helper scripts 2017-04-20 21:37:25 -05:00
mfpub Tweak git helper scripts 2017-05-05 13:32:31 -05:00
mfqp New git helper scripts 'mfadd' and 'mfqp' 2017-04-20 21:37:25 -05:00
mfrb Tweak git helper scripts 2017-05-05 13:32:31 -05:00
mfup Improve existing git helper scripts 2017-04-20 21:37:25 -05:00
README.md Tweak git helper scripts 2017-05-05 13:32:31 -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.

Merge vs Rebase

I recommend not using Github Desktop to sync and merge. Use the command line instead. Github Desktop provides a "merge" option, but for best results "git rebase" is recommended. Merge applies new work after your commits. This buries them and makes it hard to bring them together as a final packaged unit. Rebase moves your commits to the end of the branch, ensuring that your commits will be 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 macOS or Linux to speed up the process of working with Marlin and submitting changes to the project.

Remotes

File Description
mfadd [user] Add Remote - Add another Github user's fork of Marlin as a remote, then fetch it. After this you can check out one of their branches and either make a PR targeted at their fork or targeted at bugfix-1.1.x.
mfinit Init Working Copy - Creates a remote named 'upstream' (for use by the other scripts) pointing to the 'MarlinFirmware' fork. Use once after checking out your fork.

Branches

File Description
mfnew [branch] New Branch - Creates a new branch based on upstream/[PR-target]. All new work should start here.
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", mfrb, and git push -f.

Documentation

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

Utilities

File Description
ghtp -[h/s] Set the protocol to use for all remotes. -h for HTTPS, -s for SSL.
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

Coming Soon!