Member-only story
Six Lesser-Known Git Commands to Make Your Life Easier
I wish I had known them sooner.
I was going through some random content on google and stumbled upon some git commands which can make your life easier.
I have spent hours doing some of the tasks manually mentioned below.
So, let’s get on with it.
Updating Your Last Commit Message
We all have experienced noticing a typo message in our commit just after hitting the enter button.
It is often frustrating and makes you look unprofessional.
git commit --amend -m 'Updated message'
Using the command, you can edit your last commit message easily.
Blank Commit
I have found cases where I want to commit, but no files are added, changed, or deleted. In this case, I had to make some changes to commit anything.
But, it is not the case anymore.
git commit -allow-empty -m "No changes made"
Using this command, you can commit without any changes. It may be helpful when you need to trigger a build step or start a new branch.