-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Doc/git force #24662
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doc/git force #24662
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggested tightening. "Make commits inaccessible by leaving no reference..." is maybe conceptually different than "discarding commits" in some way I don't understand, but I don't think it's actually different?
Co-authored-by: Jody Klymak <[email protected]>
Co-authored-by: Oscar Gustafsson <[email protected]>
``--force`` will do the push no matter what, whereas ``--force-with-lease`` | ||
will only do the push if the remote branch is where the local ``git`` client | ||
thought it was. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the force-push, the tree example will be the same on both the local and ``origin`` branches and the old commits, ``A, B, C``, will be lost (though hopefully squashed into ``A'``): | |
.. code-block:: none
D---A'---E cool-feature, origin/cool-feature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean, working on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Totally optional - I was about to merge, but thought it would be nice to the back to the example.
Co-authored-by: Jody Klymak <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should merge.
It would be nice if there were an open-source definitive guide to git that we could just reference for all this stuff instead. gitwash
was an attempt at that, but the 5 or so git commands I actually use were buried in pages of esoterica. It seems a numfocus or scipy opinionated guide to the general git/github development flow that we could all just reference would be good. We have one, xarray has a pretty good one, there are probably others. But there is nothing in here that is unique to Matplotlib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, thanks @tacaswell ! One thing that may be worth linking to, but could be on a follow up, is some documentation on reflog. I've found not a lot of people know about it and it can be really helpful when trying to understand what happened or in what state the repo is.
PR Summary
Twice this week I have written out an explanation of force-pushing so I wrote it up for the docs.
There is some minor re-arrangement of the sub-sections that I thought made more sense, but I would drop the first two commits with no argument if people prefer the old order.