Skip to content
On this page

여러 개의 커밋 로그를 하나로 묶기

Title
여러 개의 커밋 로그를 하나로 묶기
Category
Git
Tags
Aliases
여러 개의 커밋 로그를 하나로 묶기
Related
Created
2 years ago
Updated
last year

git squash

Example

  1. 상위 3개의 커밋을 squash할 경우
sh
$ git rebase -i HEAD~3
$ git rebase -i HEAD~3
pick 7c65355 Task 1/3
squash 2639543 Task 2/3
squash d442427 Task 3/3

# Rebase 2260a88..d442427 onto 2260a88
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
pick 7c65355 Task 1/3
squash 2639543 Task 2/3
squash d442427 Task 3/3

# Rebase 2260a88..d442427 onto 2260a88
#
# Commands:
#  p, pick = use commit
#  r, reword = use commit, but edit the commit message
#  e, edit = use commit, but stop for amending
#  s, squash = use commit, but meld into previous commit
#  f, fixup = like "squash", but discard this commit's log message
#  x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
  1. initial commit을 포함하고 싶을 때 - 최초 커밋 수정하기
sh
$ git rebase -i --root
$ git rebase -i --root

Reference

Released under the MIT License.