Git Cheatsheet

Original Date: 06/13/2020


layout: page
title: Git Cheatsheet
categories: [tech]
tags: [git, tech, cheatsheet]
comments: true


squash commits

  1. Choose the exact number of commits that you want to squash
    git rebase -i HEAD~4
  2. In the menu that shows up, supply 'r' (reword) command for the top line (also note that in git the lines are listed in reverse chronological order
  3. For all other lines, supply 's' (squash) command, and save (:x) the menu
  4. The next menu would allow you to reword the top line commit, and the subsequent one would squash the remaining commits
  5. force push the squashed commits (git push --force)