Skip to content

Instantly share code, notes, and snippets.

@evanvin
Created August 1, 2023 13:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save evanvin/ca6f89d5aab95f0ae18f84de7e6a28a5 to your computer and use it in GitHub Desktop.
Save evanvin/ca6f89d5aab95f0ae18f84de7e6a28a5 to your computer and use it in GitHub Desktop.
Helping tips for getting used to the Github fork flow

In the following text, anything mentioned as upstream is the remote name I use for my non-fork git remote

Start

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  

when ready to rebase master into your branch (before PR is approved)

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 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment