Git
git shortlog -s -ngit reset --hard # Reset any changes git clean -fd # Delete newly added files and directoriesgit-clean - Remove untracked files from the working tree -d for removing directories -f remove forcefully -n Don’t actually remove anything, just show what would be done. -X Remove only files ignored by Git. This may be useful to rebuild everything from scratch, but keep manually created files.# dry-run git clean -dfX -n # if above command looks good, then run this: git clean -dfXgit remote prune origin --dry-rungit remote set-url origin git@github.com:xmlking/yeti.gitgit config --global init.defaultBranch develop git config --global pull.rebase falsegit tag new old git tag -d old git push origin :refs/tags/old git push --tags git pull --prune --tagsgit reset --soft HEAD~1 # If you don't want to keep these changes, simply use the --hard flag. git reset --hard HEAD~1git describe --tags # Delete Tags ## local git tag --delete v0.1.3 ## remote git push --delete origin v0.1.3# Step 1 # create main branch locally, taking the history from master git branch -m master main # Step 2 # push the new local main branch to the remote repo (GitHub) git push -u origin main # Step 3 # switch the current HEAD to the main branch git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main # Step 4 # change the default branch on GitHub to main # https://docs.github.com/en/github/administering-a-repository/setting-the-default-branch # Step 5 # delete the master branch on the remote git push origin --delete master# Create a worktree and change to its directory git worktree add -B my-branch && cd ../my-branch
Last updated