LoginSignup
0
0

More than 5 years have passed since last update.

Gitでcommitをまとめてみる

Posted at

rebase -i

$ git log --oneline
980c127 third commit.
cee9bf2 second commit.
9948182 first commit.

$ git rebase -i HEAD~~
[detached HEAD 01773a5] second commit.
 2 files changed, 2 insertions(+)
 create mode 100644 fuga.csv
 create mode 100644 hoge.csv
Successfully rebased and updated refs/heads/master.

$ git log --oneline
01773a5 second commit.
9948182 first commit.

git merge --squash

$ git branch
* feature/hoge
  master

$ git log --oneline
685f2cd branch second.
3db2c11 branch first.
81ce98c third commit 2.
01773a5 second commit.
9948182 first commit.

$ git merge --squash feature/hoge
Updating 81ce98c..685f2cd
Fast-forward
Squash commit -- not updating HEAD
 branch.csv | 1 +
 branch.tsv | 1 +
 2 files changed, 2 insertions(+)
 create mode 100644 branch.csv
 create mode 100644 branch.tsv

$ git ci -a
[master b18e876] Squashed commit of the following:
 2 files changed, 2 insertions(+)
 create mode 100644 branch.csv
 create mode 100644 branch.tsv

$ git log --oneline
b18e876 Squashed commit of the following:
81ce98c third commit 2.
01773a5 second commit.
9948182 first commit.

参考

0
0
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
0
0