pcottle / learnGitBranching

An interactive git visualization and tutorial. Aspiring students of git can use this app to educate and challenge themselves towards mastery of git!
https://pcottle.github.io/learnGitBranching/
MIT License
30.52k stars 5.75k forks source link

Add more clarification on "git branch -f" command #1115

Closed VladPetriv closed 10 months ago

VladPetriv commented 10 months ago

The git branch -f { branch_name } HEAD^ is only allowed if you are not at { branch_name }. If you are at the { branch_name } you'll receive an error fatal: cannot force update the branch 'main' checked out at. It's not so obvious, so could you please add this clarification on Branch forcing page?)

Знімок екрана 2023-11-14 о 21 49 46
pcottle commented 10 months ago

Ah yeah so in normal git you aren't allowed to force update the branch you are on.

I felt like it wasnt worthwhile to include this restriction in the lessons, because its just extra work to go to another branch and then go back. It definitely diverges from git normally, but we do that in a few places in the lesson

VladPetriv commented 10 months ago

I felt like it wasnt worthwhile to include this restriction in the lessons, because its just extra work to go to another branch and then go back. It definitely diverges from git normally, but we do that in a few places in the lesson

I agree that we should not add this limitation to the practical lessons.

Instead, I suggest adding the mention of this limitation to the first page of the theoretical lesson in a format like this:

Note: In a real git environment git branch -f command is not allowed for your current branch.
pcottle commented 10 months ago
Screenshot 2023-11-21 at 11 36 05 AM
VladPetriv commented 10 months ago

Thank you)