Zulip Chat Archive

Stream: general

Topic: git help


Scott Morrison (Apr 11 2018 at 10:23):

Sorry to have to ask about mundane things like how to use git, but... Say that I've got a fork of mathlib that is borked in some way (in my case, I merged in a commit from master, that Mario shortly thereafter deleted, but I have a branch that includes it).

Should I:
1) Just delete my whole fork (this is a good moment to do so, I have only two modified files).
2) Learn about ... rebasing? something else? Is it possible to actually get my master branch back to matching the main repository's master branch?

Sebastian Ullrich (Apr 11 2018 at 10:25):

Is it possible to actually get my master branch back to matching the main repository's master branch?

git reset --hard origin/master

Scott Morrison (Apr 11 2018 at 10:25):

But what about all the pushed commits to master on my github fork?

Scott Morrison (Apr 11 2018 at 10:26):

That won't bring my fork hosted on github back to matching the corresponding branch on the main github repo, will it?

Sebastian Ullrich (Apr 11 2018 at 10:27):

Ah. It will after a git push --force <your remote>.

Scott Morrison (Apr 11 2018 at 10:29):

But ... don't I have to strip commits or something?

Scott Morrison (Apr 11 2018 at 10:29):

I want my master branch in my fork to really look (history and everything) just like the master branch in origin.

Scott Morrison (Apr 11 2018 at 10:30):

Or is it okay to just continue on with my fork having its own alternative borked history?

Sebastian Ullrich (Apr 11 2018 at 10:30):

After these two commands, your fork's master will look exactly like the one in origin

Scott Morrison (Apr 11 2018 at 10:32):

Ah, and the --hard you added above means I don't even need to git checkout -- .. Thanks.

Scott Morrison (Apr 11 2018 at 10:34):

Wow, amazing! Everything is beautiful. :-)

Sebastian Ullrich (Apr 11 2018 at 10:35):

:)


Last updated: Dec 20 2023 at 11:08 UTC