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

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

Specify a username when running git clone

In order to avoid errors such as fatal: Authentication failed for .... You’ll have to enter the password in a subsequent prompt

git clone https://<username>

– via StackOverflow