Even years after leaving CVS and SVN behind, git continues to amaze me as a Swiss Army Knife of version control. It certainly has esoteric edge cases, but often makes hard things approachable and easy things truly easy. Here's a quickie you probably already know!

I recently forked some personal projects from GitHub to GitLab. After making a lot of improvements in the GitLab project, I wanted to quickly merge those back into the GitHub project. My initial thought was to simply delete the GitHub project or add a "now maintained on GitLab" note, but since the project had stars I wanted to be a bit more kind.

Git made this quick and easy:

git remote -v # origin pointing to current project
git remote add upstream <newProjectURL>
git fetch upstream
git merge upstream/master # use --squash if you want a single commit
# fix conflicts if needed by simply deleting/copying from new project
git commit -am 'pull in updates from new project'
git push

Merge conflicts are likely if you've made significant changes, but since the new project is authoritative you can simply replace anything with conflicts with their new versions, git add and commit as above.

Some times it's the simplest things done well that delight!