1

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?

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
SctALE
  • 509
  • 2
  • 10
  • 30

1 Answers1

3
git checkout cdcab96 -- /dir1

would do the trick.

Check the relevant part in the checkout man page here.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
  • Do I need to do a pull or can I just do another commit and a push in order to update the remote repository? – SctALE Apr 09 '19 at 07:50
  • @SctALE It depends on the state of the remote. Pull if someone updated it, yes, but it's not required per se. And when you'll want to reflect the recent rollback of this dir on the remote, indeed push (without need of force, you did not change history) – Romain Valeri Apr 09 '19 at 08:00