My articles about Git

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

The following list is a reference to the Git commands I use the most. Beneath every command there is an explanation of its use.

As of September 2024, I updated the list with more helpful Git commands.

Read the complete article