thinking about git reset today and I'm wondering why we usually use `git reset` instead of `git branch --force` to force a branch to point at a different commit

I guess it's mostly more ergonomic? (because you can't use `git branch -f` if you have the branch you want to change checked out)

`git branch` kind of feels like a more natural home for that functionality though, and the `--force` makes it more clear that it's potentially a dangerous action

Follow

@b0rk I tend to do a lot of "git branch -f" because I work with submodules which leads to not having a branch checked out.

If you do have a branch checked out, then I feel like moving it would involve some combination of branch -f + checkout, which would probably be a lot safer and more intuitive than git reset, come to think of it..

I guess you'd do something like
git checkout [flags] commit && git branch -f branch commit && git checkout branch

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!