SctALE
SctALE

Reputation: 519

Git rollback only a directory

This is the history of my last commits:

(most recent)
commit 349aee3, changes in /dir1 and /dir2
commit fe9a5ac, changes in /dir1 and /dir2
commit d88450e, changes in /dir1 and /dir2
commit cdcab96, changes in /dir1 and /dir2

I would like to rollback dir1 to commit cdcab96, leaving the other directories, including /dir2 in the current state (commit 349aee3).

Is there a way to do that?

Upvotes: 1

Views: 81

Answers (1)

Romain Valeri
Romain Valeri

Reputation: 22065

git checkout cdcab96 -- /dir1

would do the trick.

Check the relevant part in the checkout man page here.

Upvotes: 3

Related Questions