
Friends I am working on wip/new-flatten-skolems-Oct14. I have pushed lots of patches up to the main repo. Now I want to rebase to clean up. Can I just do a local rebase and then git push? Nothing special about the push? I know that will confuse anyone who is pulling from that branch, but I've warned them! Simon

Now I want to rebase to clean up. Can I just do a local rebase and then git push? Nothing special about the push?
You need 'push -f' to force overwriting the old version of your branch. Please make sure you are not forcefully pushing while on master branch, though. ;) (I seem to remember 'push -f' can be blocked on master, but I don't know if it is in our repo.)
I know that will confuse anyone who is pulling from that branch, but I’ve warned them!
If they do 'git fetch', they can compare the old and the new version of the branch and mix and match at will.

| You need 'push -f' to force overwriting the old version of your | branch. Please make sure you are not forcefully pushing while on | master branch, though. ;) (I seem to remember 'push -f' can be blocked Right! I'm on branch wip/new-flatten-skolems-Oct14, so git push --force should push just that branch right? If I want to be super-safe, and say "push only this branch" would I say git push --force HEAD or git push --force wip/new-flatten-skolems-Oct14 or something like that? S | -----Original Message----- | From: Mikolaj Konarski [mailto:mikolaj@well-typed.com] | Sent: 31 October 2014 11:24 | To: Simon Peyton Jones | Cc: ghc-devs@haskell.org | Subject: Re: git question | | > Now I want to rebase to clean up. Can I just do a local rebase and | > then git push? Nothing special about the push? | | You need 'push -f' to force overwriting the old version of your | branch. Please make sure you are not forcefully pushing while on | master branch, though. ;) (I seem to remember 'push -f' can be blocked | on master, but I don't know if it is in our repo.) | | > I know that will confuse anyone who is pulling from that branch, but | > I’ve warned them! | | If they do 'git fetch', they can compare the old and the new version | of the branch and mix and match at will.

Right! I'm on branch wip/new-flatten-skolems-Oct14, so git push --force should push just that branch right?
If I want to be super-safe, and say "push only this branch" would I say
git push --force HEAD or git push --force wip/new-flatten-skolems-Oct14 or something like that?
To ensure, that you're only operating on your current branch you can add to your '~/.gitconfig': [push] default = simple Newer versions of git have this now as their default behaviour, but I'm not quite sure which git version was the first one. Greetings, Daniel

On Fri, Oct 31, 2014 at 12:37 PM, Daniel Trstenjak
To ensure, that you're only operating on your current branch you can add to your '~/.gitconfig':
[push] default = simple
Oh, useful.
(I seem to remember 'push -f' can be blocked on master, but I don't know if it is in our repo.)
Herbert tells me that actually 'push -f' (aka "non-fast-forwards") is forbidden in the GHC repo everywhere except wip/, as part of a configuration that also restricts touching named GHC version branches, handles mirroring, etc. So it's harder to mess up a repo that in ye olde days, though I'm sure one can still produce lots of colourful git art (to be watched in the 'gitk' art viewer) by repeatedly merging forward and backward two branches, without any rebasing.

Right! I'm on branch wip/new-flatten-skolems-Oct14, so git push --force should push just that branch right?
Right. But don't trust me, try with --dry-run.
If I want to be super-safe, and say "push only this branch" would I say
git push --force HEAD or git push --force wip/new-flatten-skolems-Oct14 or something like that?
The latter seems safest. Probably git push --force origin wip/new-flatten-skolems-Oct14 would work, depending on how your remotes are named. Again, --dry-run. :)
participants (3)
-
Daniel Trstenjak
-
Mikolaj Konarski
-
Simon Peyton Jones