Useful Git CLI Command
CI/CD
Join us for free and unlock more features!
Access all features and save your workâno cost, no hassle.
CI/CD
PREFIX and $3 accordingly.Bash
index
git branch -r | awk -F/ '/\/{PREFIX}/{print $2 "/" $3}' # To list out all the branch before delete
git branch -r | awk -F/ '/\/PREFIX/{print $2 "/" $3}' | xargs -I {} git push origin :{} # to deleteBash
index
git reset ~HEADBash
index
git push -d <remote_name> <branchname> # Delete remote
git branch -d <branchname> # Delete localBash
index
# 1. Move back to commit A
git checkout <commit-A-hash>
# 2. Create a new branch (optional but safer)
git checkout -b rollback-to-A
# 3. Force push to overwrite remote main branch
git push origin HEAD:main --force