4

Git: Create an empty commit

 1 year ago
source link: https://proinsias.github.io/til/git-create-an-empty-commit/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Francis T. O'Donovan

Data Science Manager at LeanTaaS – Planet discoverer, researcher, developer, geek.

Git: Create an empty commit

May 1, 2023

less than 1 minute read

If you are working with a CI/CD pipeline (and you should be), sometimes you need to trigger the pipeline without making changes to the code. Instead of changing files adding empty lines at the end, creating unnecessary logs, we can create an empty commit:

git commit --allow-empty -m 'Empty commit'
git push

Via Daniel Genezini.

Usually recording a commit that has the exact same tree as its sole parent commit is a mistake, and the command prevents you from making such a commit. This option bypasses the safety, and is primarily for use by foreign SCM [Source Control Management] interface scripts.

Via the git docs.

Tags: git til

Categories: til

Updated: May 1, 2023

Previous Next

You may also enjoy


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK