Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git reset all files with particular extension

I have changes in many types of file like .tsx .scss and .scss.d.ts, and have committed and pushed to my branch.

Is there any way I can reset only extension .scss.d.ts with master ?

Keep the changes in .tsx and .scss only reset .scss.d.ts with master.

Thanks

like image 325
ankitd Avatar asked Oct 16 '19 08:10

ankitd


Video Answer


1 Answers

You could first output a list of the paths with

git ls-files master -- *.scss.d.ts

then that list can be send to the checkout command* to restore each of them to their state on master

git checkout master -- $(git ls-files master -- *.scss.d.ts)

* Note that since recent git versions, you also have git restore to the same effect

git restore --source=master '*.scss.d.ts'
like image 144
Romain Valeri Avatar answered Sep 30 '22 04:09

Romain Valeri