git branch -d(-D) branch_name
// flag -D
means force delete
git push origin -d branch_name
git rebase -i HEAD~N
, where N is the number of commit you want to squash
pick commit_1
squash commit_2…N-1
or use p
for pick
, s
for squash
and etc.
git push -f
(или типа того, forse rebase короче)
git commit —amend -m “new commit msg”
(если изменить commit message до пуша в ремоут)
git push —force <repository> <branch>
(если в ремоут уже запушили, типа git push —force origin feature/featureName)
Rename the local branch by typing:
git branch -m <new_name>
Push the <new_name> local branch and reset the upstream branch:
git push origin -u <new_name>
Delete the <old_name> remote branch:
git push origin --delete <old_name>
basics:
git stash
git stash apply
advanced:
git stash push -m "my_stash"
// give current stash a name
git stash list
// list all recent stashes stored in a stack
git stash pop stash@{n}
// apply stash and remove it from the stack, n
is the index of the stashed change
git stash apply stash@{n}
// apply stash and keep it in the stack
git stash apply my_stash
// apply stash by name (TODO: check that it works)
add stash, update file for .md