For When You Can't Have The Real Thing
[ start | index | login ]
start > git > Squashing multiple commits into one

Squashing multiple commits into one

Created by dave. Last edited by dave, 69 days ago. Viewed 47 times. #1
[edit] [rdf]
labels
attachments
(2017-09-14)

Squashing multiple commits into one:

git log shows you the history:

[dave@store02 ansible]$ git log
commit 777574670a1c5dccc91f12320a811759163e4ff9
Author: David Mackintosh <dave@gridway.net>
Date:   Thu Sep 14 12:20:31 2017 -0400

davem.sh handles centos and fedora now

commit 22a613ea808bd00ab86b1c432968a5207c814f38 Author: David Mackintosh <dave@gridway.net> Date: Thu Sep 14 11:36:51 2017 -0400

fix fedora version check

commit e5d4c928c8bdfed6afdfd35b9c5f50883326f99a Author: David Mackintosh <dave@store02.gridwayit.local> Date: Thu Sep 14 11:23:46 2017 -0400

back to post-fedora version of davem.sh

commit 241e3d9efc0842dfb91553691790d4c487e9c072 Author: David Mackintosh <dave@store02.gridwayit.local> Date: Thu Sep 14 11:23:10 2017 -0400

pre-fedora version of davem.sh

commit 4995a0fe82ba1491a55e8f7af3ad67d305533148 Author: David Mackintosh <dave@store02.gridwayit.local> Date: Thu Sep 14 11:14:32 2017 -0400

Initial commit

git reset brings the repository pointers back to a given version:

[dave@store02 ansible]$ git reset 241e3d9efc0842dfb91553691790d4c487e9c072
Unstaged changes after reset:
M       roles/environment/davem.sh

Now you can just commit the changes in one go:

[dave@store02 ansible]$ git commit -m "Change centos/redhat/fedora and version detection" roles/environment/davem.sh
[master 2c0d620] Change centos/redhat/fedora and version detection
 1 files changed, 36 insertions(+), 16 deletions(-)

...and observe the changes:

[dave@store02 ansible]$ git log
commit 2c0d620f012d2c931e287a779fb4892a876aa7d6
Author: David Mackintosh <dave@gridway.net>
Date:   Thu Sep 14 12:28:18 2017 -0400

Change centos/redhat/fedora and version detection

commit 241e3d9efc0842dfb91553691790d4c487e9c072 Author: David Mackintosh <dave@store02.gridwayit.local> Date: Thu Sep 14 11:23:10 2017 -0400

pre-fedora version of davem.sh

commit 4995a0fe82ba1491a55e8f7af3ad67d305533148 Author: David Mackintosh <dave@store02.gridwayit.local> Date: Thu Sep 14 11:14:32 2017 -0400

Initial commit

no comments | post comment

Virtual Dave Megaplex:

Internet Explorer 6 Users >>Click Here

(read this note about local search)

Logged in Users: (0)
… and 28 Guests.


Editing: snipsnap-help, Image Macro

(Et auditum est, et idcirco ego nunc simulare)

Installed 6 years and 314 days ago
Powered By >>SnipSnap Version 1.0b1-uttoxeter

This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt