Git Worktree: A Practical Guide (with Examples)
Introduction When working on multiple features or fixing bugs in any given project, it’s crucial to organize your workflow efficiently. Git is a powerful version control system deeply…
How to merge two Git repositories into one (not two branches)
Overview Merging two separate Git repositories into one without intertwining their histories is a task that may be needed when combining products, services, or simply for organizational consolidation….
Git Fatal Error: ‘Refusing to Merge Unrelated Histories’
The Problem The error message fatal: refusing to merge unrelated histories is one that you might encounter when working with Git, particularly during merges. This error indicates that…
Deleting sensitive files from Git history with BFG Repo-Cleaner
Overview There often comes a time in the life of a developer when sensitive data is accidentally pushed to a Git repository. Perhaps it’s a password, an API…
How to add an empty folder to a Git repository
Introduction Version control systems like Git are fantastic at tracking changes to files and directories in your project. But sometimes, you may come across a peculiar situation where…
How to update the author of a Git commit
Introduction Git is a versatile version control system that tracks changes in source code during software development, but sometimes users might need to alter the commit history for…
Git: How to remove a very large file from commit history
Introduction Version control systems like Git are essential for modern software development, providing a means to track changes, revert to previous stages, and collaborate with others. However, a…
How to instruct Git stop tracking a file that was recently added to .gitignore
Introduction Adding a file to a .gitignore file informs Git to exclude it from tracking. However, if the file was already tracked prior to its inclusion in .gitignore,…
Using ‘git reset –hard’ to undo local changes (with examples)
Overview If you’re involved with software development or you work within a team managing code changes, you’ll likely encounter the need to undo changes to your Git repository….
Using the ‘–force’ and ‘–force-with-lease’ options with git push
Introduction When you’re working with Git, sometimes you may need to overwrite the history on the remote repository for various reasons, such as fixing mistakes or cleaning up…