Git and not rebasing branches pushed remotely ?
Misagh Moayyed
mmoayyed at unicon.net
Sat Sep 26 03:18:49 EDT 2015
> I only have the vaguest understanding of any of it, but I generally grasp
> why you don't want others working off a branch you might rebase.
>
> I think publically speaking our branches are just meant for if we need to
> patch an older minor like we did with 3.1. If you need to make branches
> available for other purpose, they probably shouldn't be in the actual
> project repos, just pushed to a personal one. I don't think it matters
> whether gitweb can see that, does it? More whether somebody else could
> clone it locally for review.
>
> -- Scott
My general workflow, if it helps as an example, is the following:
1. Create local branch for IDP-XYZ off of master
2. Add/commit/push to personal repo, under a remote tracking branch of the
same name, (i.e Misagh/IDP-XYZ)
3. Create a PR from Misagh/IDP-XYZ to origin/master
4. Reviews, edit, commit, squash (I generally don't do this), keep pushing
Misagh/IDP-XYZ
5. PR is merged into origin/master. (Note: doesn’t have to be PR)
6. Checkout my local branch that tracks origin/master (i.e. master)
7. Pull from origin/master.
8. Optionally and periodically, push to Misagh/master. (I very rarely do
this, unless I have others using my repo)
9. Go back to step #1
So the origin repo will only contain canonical branches for master and
various maintenance branches. My personal repo that mirrors it will have all
kinds of branches that need to be pruned every once in a while because those
branches are merged into master and then deleted. So once a week, I would
do:
git remote prune <my-personal-remote-name>
I never ever rebase; prefer merge commits better, but I guess to your
question: there is no way that I know that you could lock git down to
disallow rebases to remotes. You just have to set up a workflow (like my
example above), and have everyone follow that, and sort of trust that nobody
is going to rewrite history. Even if that happens by an accident, since
everyone carries a copy of the repo locally with all its history, you can
easily restore it altogether.
HTH.
More information about the dev
mailing list