Skip to content

Instantly share code, notes, and snippets.

@jbeda
Last active March 8, 2019 20:33
Show Gist options
  • Save jbeda/0fb9748db43ecb14f72f8662516a8047 to your computer and use it in GitHub Desktop.
Save jbeda/0fb9748db43ecb14f72f8662516a8047 to your computer and use it in GitHub Desktop.
I love `git commit --fixup`
# Have origin be your fork, upstream is upstream.
$ git remote -v
origin [email protected]:jbeda/kubernetes.git (fetch)
origin [email protected]:jbeda/kubernetes.git (push)
upstream [email protected]:kubernetes/kubernetes.git (fetch)
upstream [email protected]:kubernetes/kubernetes.git (push)
# Make some changes to a bunch of files in a multi commit PR
# Find the commit you want to tweak, copy the hash
$ git log
# Commit that file with the `--fixup` flag.
$ git add file.go
$ git commit --fixup f6d3505ddc6c3944b354cf3f4f2583e6c8775581
# Now rebase (without a fetch) to automatically squash the fixup commits
$ git rebase -i --autosquash upstream/master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment