Home > OS >  How can I revert an entire subdirectory on my branch to be what it is on main?
How can I revert an entire subdirectory on my branch to be what it is on main?

Time:05-05

I have a branch in pull request. However, I have committed some changes that I don't want, so it will show changes like so:

package.json
yarn.lock
packages/
  some-package/
    a.ts
    b.ts
    styles/
      c.css

I want to revert the entire packages/** directory to what it was before my PR was opened

How would this be done?

CodePudding user response:

git restore --source=main ./packages
git add packages
git commit -m "Remove accidentally committed packages"
# Optionally git push
  • Related