Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 7 commits into from
Dec 9, 2022
Merged

Doc/git force #24662

merged 7 commits into from
Dec 9, 2022

Conversation

tacaswell
Copy link
Member

@tacaswell tacaswell commented Dec 8, 2022

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.

@tacaswell tacaswell added this to the v3.7.0 milestone Dec 8, 2022
@tacaswell tacaswell requested a review from melissawm December 8, 2022 04:57
Copy link
Member

@jklymak jklymak left a 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]>
``--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.

Copy link
Member

@jklymak jklymak Dec 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member

@jklymak jklymak left a 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.

Copy link
Member

@melissawm melissawm left a 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.

@jklymak jklymak merged commit fa9a28b into matplotlib:main Dec 9, 2022
@tacaswell tacaswell deleted the doc/git_force branch March 15, 2023 20:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants