GIT

General

Clone private repo with GitHub Token:

git clone https://username:[email protected]/username/repo_name.git

Default Branch

Change local branch name for new inits:

git config --global init.defaultBranch main

Update after remote renaming:

git branch -m master main
git fetch origin
git branch -u origin/main main
git remote set-head origin -a

Remove Git history

Remove all history(make sure you have the backup) using:

cat .git/config  # note <github-url>
rm -rf .git

Reconstruct the git repo with the current content:

Push the commit to github

Hotfix

Checkout latest tag and create new branch:

Publish branch and create a new release from branch

Commit in past

Last updated