Can git be configured to prevent rebase of already published commits? -


i want use git pull --rebase instead of merge approach 1 can accidentally rebase commits pushed remote.
in case merge on pull mandatory.

is there way configure git rejects rebase if of commits going rebased pushed other remote?

try command:

git rebase --onto <remote>/<branch-name> $(git rev-list head \  --not --exclude=$(git rev-parse --symbolic-full-name head) \  --glob=refs/* --reverse | head -1)~ 

this rebase commits done on current local branch.

if want include local changes other branches not pushed yet change --glob=refs/* expression --remotes. please aware, though may push these local branches in future, use caution.

clarification: of course, since not using git pull, need execute git fetch prior rebasing. (i happen prefer git fetch + git rebase or git merge, can in control of rebasing onto or merging.)


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -