DELETE LARGE FILES FROM HISTORY
git rev-list --objects --all | git cat-file --batch-check='%(objectname) %(objecttype) %(objectsize) %(rest)' |
sort -k3 -n -r | head -n 10
pip3 install git-filter-repo && export PATH=$PATH:~/.local/bin
git-filter-repo --path <FILENAME> --invert-paths --force
SEMANTIC-RELEASE
sudo apt install npm -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
source ~/.bashrc
nvm install 20 && nvm use 20
nvm alias default 20
# INSTALL w/ npm
npm install --save-dev semantic-release @semantic-release/commit-analyzer @semantic-release/release-notes-generator @semantic-release/changelog @semantic-release/git @semantic-release/github @semantic-release/gitlab
---
cat <<EOF > .releaserc
{
"branches": ["main"],
"repositoryUrl": "https://codehub.sva.de/Lab/stuttgart-things/homerun/homerun-generic-pitcher.git",
"gitlabUrl": "https://codehub.sva.de",
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/gitlab",
{
"assets": ["CHANGELOG.md", "go.mod", "go.sum"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
EOF
git commit -am 'feat: add new authentication middleware' # → Minor version
git commit -am 'fix: resolve panic in user login' # → Patch version
git commit -am 'BREAKING CHANGE: switch to OAuth2 for authentication' # → Major version
npx semantic-release --dry-run
npx semantic-release --debug --no-ci
BRANCHES
# LIST ALL EXISTING BRANCHES
git branch
# DELETE LOCAL BRANCH
git branch -d [branch]
# SWITCH YOUR HEAD TO BRANCH
git checkout [branch]
# CREATE A NEW BRANCH BASED ON YOUR CURRENT HEAD
git branch [new-branch]
# CREATE A NEW BRANCH BASED ON YOUR CURRENT HEAD AND SWITCH
git checkout -b [new-branch]
# PUSH LOCAL BRANCH TO REMOTE BRANCH
git push -u origin [new-branch]
# CHECK OUT REMOTE BRANCH
git fetch && git checkout [remote-branch-name]
# e.g. git fetch && git checkout remotes/origin/feature/issue-1/test
LOG
# SHOW LATEST n commits
git log --pretty=format:"%h" --first-parent -n [count-commits] [branch-name]
# e.g. git log --pretty=format:"%h" --first-parent -n 3 remotes/origin/feature/issue-1/test
TAGS
# PULL/FETCH TAGS
git fetch --tags --force
git pull --tags
# LIST TAGS
git tag
# CREATE LOCAL TAG
git tag [tagname]
# PUSH SINGLE TAG TO REMOTE
git push origin [tagname]
# PUSH ALL TAGS TO REMOTE
git push origin --tags
# DELETE LOCAL TAG
git tag --delete [tagname]
# DELETE REMOTE TAG '1.0.0'
git push origin :refs/tags/1.0.0
PULLING IS NOT POSSIBLE - UNMERGED FILES
git reset HEAD~1
git stash
git pull