LoginSignup
20
10

More than 5 years have passed since last update.

git rebaseでinitial commitをまとめる

Posted at

gitコマンドのTIPSです。
2個だけコミットがあり、その2つをrebaseでまとめたい時、git rabese -i HEAD^^を実行してもinitial commmitが表示されません。
代わりに以下のコマンドを発行すると、ちゃんとinitial commitもrebaseできます。

$ git rebase -i --root
pick 8ffb8da first commit
pick bda2f1d test

# Rebase bda2f1d onto c38fdf9 (2 command(s))
#
# 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
# d, drop = remove commit
#
# 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
20
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
10