/
squashing commit

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

    :)


Related content

squash commit already pushed
squash commit already pushed
More like this
소스트리에서 git squash commit 을 이용하여 여러 개의 커밋을 합치고 정리하기
소스트리에서 git squash commit 을 이용하여 여러 개의 커밋을 합치고 정리하기
More like this
github PR(pull request) 을 merge 하지 않고 local 로 받기
github PR(pull request) 을 merge 하지 않고 local 로 받기
More like this
github 에서 push나 PR(pull request) 할때 issue 연결하기
github 에서 push나 PR(pull request) 할때 issue 연결하기
More like this
cherry pick a range of commits and merge into another branch
cherry pick a range of commits and merge into another branch
More like this
git fetch vs pull
git fetch vs pull
More like this