Hacking The History — Git Amend

Forgot to do something in your last commit? Take it easy, git amend to the rescue

git log
commit 355e47d4d495a7d10ec0814cd1e472b03ee77d1b (HEAD -> master, origin/master)
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:35:56 2021 +0200
Improved stylingcommit 27d1bb599ce8f914c5e4d42b0ec08095a73c2f10
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:28:28 2021 +0200
Created first file
commit a3ee725e0a3e6265df4747cd7fc558e200b56dbe (HEAD -> master, origin/master)
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:40:24 2021 +0200
Fixed typocommit 355e47d4d495a7d10ec0814cd1e472b03ee77d1b
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:35:56 2021 +0200
Improved stylingcommit 27d1bb599ce8f914c5e4d42b0ec08095a73c2f10
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:28:28 2021 +0200
Created first file
git add .
git commit --amend
Improved styling and added readme.md
Please enter the commit message for your changes. Lines starting
with '#' will be ignored, and an empty message aborts the commit.
#
Date: Mon Apr 26 21:35:56 2021 +0200
#
On branch master
Changes to be committed:
modified: a.txt
new file: second.txt
#
:wq
4dad158 (HEAD -> master) HEAD@{0}: commit (amend): Improved styling
.
.
.
a3ee725 HEAD@{7}: commit: Fixed typo
355e47d (origin/master) HEAD@{8}: commit: Improved styling
27d1bb5 HEAD@{9}: commit (initial): Created first file
git push -f origin master
commit 4dad158f6574c96f6647ba1ce1fa2ce965884ce3 (HEAD -> master, origin/master)
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:35:56 2021 +0200
Improved stylingcommit 27d1bb599ce8f914c5e4d42b0ec08095a73c2f10
Author: pmarciszekkosieradzki patryk.kosieradzki@gmail.com
Date: Mon Apr 26 21:28:28 2021 +0200
Created first file

--

--

Senior Android Engineer @ Moss, Podcaster @ AndroidTalks, based in Warsaw, Poland

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Patryk Kosieradzki

Patryk Kosieradzki

Senior Android Engineer @ Moss, Podcaster @ AndroidTalks, based in Warsaw, Poland