Git
git checkout -b "<new_branch_name>" "<from_branch>"
git checkout -b feature_x main
git checkout -b feature_x
new_branch_name
– is a name of your branchfrom_branch
– is a name of branch from which need to create new branch, could be empty, in that case will be used the current branch
Syntax
git branch -D "<branch_name>"
Example
git branch -D feature_x
Syntax
git push "<remote_name>" --delete "<branch_name>"
Example
git push origin --delete feature_x
If you're on the branch
feature_x
and you need to pull changes from the main
branch, then the next example will be usefulgit fetch origin main # pull the latests changes from remote
git checkout feature_x
git rebase origin/main
git push --force
git reset --soft HEAD~<number_of_commits_to_squash>
git commit -m "Squash commit meesage"
git push --force
Last modified 1yr ago