Skip to content

Instantly share code, notes, and snippets.

@pandeybk
Created May 9, 2018 01:09
Show Gist options
  • Save pandeybk/0e86e5c89fb8057ca5d37a058908ef84 to your computer and use it in GitHub Desktop.
Save pandeybk/0e86e5c89fb8057ca5d37a058908ef84 to your computer and use it in GitHub Desktop.
Squash several Git commits into a single commit
git checkout master
git fetch
git pull
# Merge the feature branch into the master branch.
git merge FEATURE/demo
# Reset the master branch to origin's state.
git reset origin/master
# Git now considers all changes as unstaged changes.
# We can add these changes as one commit.
# Adding . will also add untracked files.
git add --all
git commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment