Table of Contents


Migrating from Mercurial to Git (and from Bitbucket to GitHub)

See this article.

Migrating from Team Foundation Server to Git

Use git-tfs.

Get a list of authors (including emails) from a repo

git shortlog --summary --numbered --email

Change current branch

# clear way (Git 2.23+)
git switch <branch_name>

# original, obscure way
git checkout <branch_name>

Sync a GitHub fork

This is all taken from GitHub’s excellent wiki, it’s just easier to find here.

Configure an upstream remote for your fork (once per fork)

# Check existing remotes
git remote -v

# Add upstream remote
git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git

Sync the fork

# Fetch upstream changes
git fetch upstream

# Make sure you're on main/master
git checkout main

# Actual merging of the changes, replace main with master if needed
git merge upstream/main

# Make sure everything gets on GitHub
git push