squashing commit



PR 보낼 때 squash 안 하면 merge 안 해줌.



위와 같이 총 6개의 커밋이 있을 경우 아래 명령어로 squash 

git rebase -i HEAD~6 
log에서 pick -> fixup 으로 수정


강제 push

git push --force


8 개의 commit squash




Ref

  • https://github.com/vhf/free-programming-books/pull/1762
  • You got 6 commits here. "Merging" them into one single commit is known as "squashing commits".

    Here's one way to do it:

    1. In your git repo, do git rebase -i HEAD~6 (because we would like to rebase 6 commits starting at the latest one, which is the current HEAD)
    2. It will open an editor. Each line starting with pick describes a commit. On the first line, you will see the first commit of this PR, this is the commit we would like to keep, so we will not modify this line. For all the following lines, replace pick with fixup.
    3. Close the editor. Git will start rewriting history.
    4. git push --force

    :)