My articles about Git

How to add a Git submodule to your repository

A Git submodule lets you include another repository inside your own project. This is useful for reusing shared code, libraries, or dependencies across multiple projects.

To add a submodule to your parent repository, follow these steps:

Read the complete article

How to restore overwritten Git commits when multiple developers are pushing changes simultaneously

Consider the following scenario. Multiple developers work on one feature branch of a project. Developer A pushes commits into the feature branch, developer B oversees that his local repository is behind origin, force pushes his commits and as a result overwrites the commits from Developer A. Developer A pulls the changes and his commits are now gone. Can Developer’s A missing commits be restored and how?

Read the complete article

Remove modified files from a Git Pull Request but keep them with their changes on your local branch

The scenario described on the title of the article happens pretty often. You committed files, pushed them to a feature branch and created a new pull request to merge them to master. However, maybe you accidentally pushed modified files, for which work is still in progress and you do not want them on master yet. So now you want to remove specific files from the pull request but keep the changes you made in these files locally. How?

Read the complete article

A work-in-progress list of my favorite Git commands

A concise reference of my most-used Git commands. Updated on March 2026.

Read the complete article