If you use git rebase -i on a branch, you should specify where you want to push. The default origin is origin/master, so be careful and don't overwrite your main branch.
So, let's say you're on a branch called feature/new-stuff and you want to rewrite its history...
Do the steps above, just remember to push to the right origin in the end. In this case: git push -f origin feature/new-stuff
Hi @leo
,
Looking at git-scm.com/docs/git-config it seems like the default push.default is simple. simple - in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one. upstream - push the current branch back to the branch whose changes are usually integrated into the current branch (which is called @{upstream}). This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow).
So if the branch names differ the push will be refused.
Cool :)
If you use
git rebase -i
on a branch, you should specify where you want to push. The default origin is origin/master, so be careful and don't overwrite your main branch.So, let's say you're on a branch called
feature/new-stuff
and you want to rewrite its history...Do the steps above, just remember to push to the right origin in the end. In this case:
git push -f origin feature/new-stuff
Hi @leo ,
Looking at git-scm.com/docs/git-config it seems like the default
push.default
issimple
.simple
- in centralized workflow, work like upstream with an added safety to refuse to push if the upstream branch’s name is different from the local one.upstream
- push the current branch back to the branch whose changes are usually integrated into the current branch (which is called @{upstream}). This mode only makes sense if you are pushing to the same repository you would normally pull from (i.e. central workflow).So if the branch names differ the push will be refused.
Oh... Ok, this is new to me. Thanks for the clarification.