Stash / Rebase

Stashing

To stash changes in git, simply run the commands below -

[kapper@kanjaro cmake]$git stash
Saved working directory and index state WIP on master: xxxxxxx Reorganized C problem 4

[kapper@kanjaro cmake]$ git stash list
stash@{0}: WIP on master: xxxxxxx Reorganized C problem 4
[kapper@kanjaro cmake]$ 

This is useful stash your local changes, pull from the remote, resolve any conflicts from your stashed changes and push back to the remote so other contributors can see your work.

Rebase

Rebasing can be used to move your work to another branch without merging the branches entirely. This is useful if the branch has more development planned or if you would like to keep the branch open for other reasons. This can also be used to modify the history, if you are careful and know what you are doing.

git rebase <remote>

OR

git rebase master
git rebase fix

etc..

git rebase --interactive or git rebase -i provides the summary for each commit in the editor it invokes

You may want to use rebase -i <commit hash> to squash your work down to a single commit, or rearrange the work in the commits to make the patch easier for the maintainer to review
https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History#_rewriting_history

Patching

To apply a patch generated by format-patch, you use git am (the command is named am as it is used to "apply a series of patches from a mailbox").

If you run a mail client that can save several emails out in mbox format, you can save entire patch series into a file and then use git am to apply them one at a time.

git diff --check, which identifies possible whitespace errors and lists them for you.