In the following text, anything mentioned as upstream
is the remote name I use for my non-fork git remote
git checkout -b ‘newFeatureBranch’
# do work
git add files
# first time committing your branch
git commit
# after first time committing branch
git commit —fixup <hash of your first commit>
# I use `fixup` for every commit after the first one because it’s something not usually taught/used and it’s a lifesaver when it comes to rebasing & squashing commits
git checkout master
git fetch upstream
git rebase upstream/master
git push origin master # optional but helpful to keep your upstream remote up-to-date
git checkout newFeatureBranch
git rebase -i —-autosquash master
# add all the 'f' (fixup; this tells those commits to use the first commit message) of left side of all commits that aren't the first commit, then save and exit the term text editor
git push origin newFeatureBranch —f