In git, I am in branch A, and I want to update branch B to be exactly equal to branch A.

In hg, this is easy. In git, the only way I can think to do it is

git branch -D B
git checkout -b B
git checkout A

Is there a better way to do this, that doesn't involve a destructive operation?

UPDATE: This appears to be the way to do it! But I'm afraid to try it lol chaos.social/@fogti/1147225241

0

If you have a fediverse account, you can quote this note from your own instance. Search https://mastodon.social/users/mcc/statuses/114722517744410789 on your instance and quote it. (Note that quoting is not supported in Mastodon.)