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
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>@server.com/path/to/repository
– via StackOverflow
Follow-up - when you want to use a different username to push b/c of permissions, etc
git remote set-url origin https://username@github.com/your-account/your-repo.git
And use a PAT as your password, of course.
Don’t forget to set a repo-specific username, to avoid leaking your main
git config user.name "username"
git config user.email "user_email@example.com"
Any and all console operations slow in git-lfs folder (e.g. anything from downloaded from Huggingface)
Run this to migrate the Git LFS pointer files present in the Git history out of Git LFS, converting them into their corresponding object files.
git lfs migrate export --everything --include .
– via StackOverflow