Author -  Sai gowtham

How to modify the commit messages in Git

In this tutorial, we are going to learn about how to change the commit git messages in local and remote repositories.

Changing Last commit git message locally

  1. Inside the command line navigate to the repository you need to modify the commit message.

  2. Run git commit command followed by the --amend flag.

git commit --ammend

This command will open an editor with a recently commit message, where we can edit the message once you are done with editing save it.

Note: The above two steps only change the locally commit git message.

Changing last commit message remotely

  1. Follow the above two steps

  2. Run the git push command followed by the --force flag to change remotely commit message.

git push --force

Changing multiple Commit messages

If you want to change the multiple commit message instead of the last commit message you need to follow the below steps.

  1. Inside the command line navigate to the repository you need to modify the commit message.

  2. Run git rebase -i HEAD~n command to display the last n number of commit messages.

git rebase -i HEAD~4

This above command will display the list of previously committed four messages, which looks similar to the below text.

pick f3999e6 thumbnail size modified
pick 67e92a3 updated size
pick 384ff6f screenshot added
pick 3c63d17 added some text

# Rebase 28d77e0..3c63d17 onto 28d77e0 (4 commands)
#
# 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.
  1. Once you’re done with editing save your commit file.

  2. Run the git push command followed by the --force flag to force the push the changed commit messages to a remote git repository.

git push --force

Css Tutorials & Demos

How rotate an image continuously in CSS

In this demo, we are going to learn about how to rotate an image continuously using the css animations.

How to create a Instagram login Page

In this demo, i will show you how to create a instagram login page using html and css.

How to create a pulse animation in CSS

In this demo, i will show you how to create a pulse animation using css.

Creating a snowfall animation using css and JavaScript

In this demo, i will show you how to create a snow fall animation using css and JavaScript.

Top Udemy Courses

JavaScript - The Complete Guide 2023 (Beginner + Advanced)
JavaScript - The Complete Guide 2023 (Beginner + Advanced)
116,648 students enrolled
52 hours of video content
$14.99 FROM UDEMY
React - The Complete Guide (incl Hooks, React Router, Redux)
React - The Complete Guide (incl Hooks, React Router, Redux)
631,582 students enrolled
49 hours of video content
$24.99 FROM UDEMY
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
Vue - The Complete Guide (w/ Router, Vuex, Composition API)
203,937 students enrolled
31.5 hours of video content
$14.99 FROM UDEMY