reset git to older commit

Hallo to all.

I’ve got some problems regarding reset to an older commit.

Steps what I do:

  1. grep the commit ID to which I would like to return

    [USER@VM gitrepo]$ git log
    commit c846a35cd30fa05a9a125d613b220245f1f7d96e
    Author: Tobias tobias@xy.de
    Date: Fri Mar 23 16:00:33 2018 +0100

     test 1 in ccc
    

    commit d567daf9e82b2bb1fa8493757826a224c4f3b96f
    Author: Tobias tobias.@xy.de
    Date: Fri Mar 23 15:58:48 2018 +0100

     test 2 hilfe.txt
    

    commit dbef962622cc6bc326bbcccb3e87332af7e9577a
    Author: Tobias tobias.@xy.de
    Date: Fri Mar 23 15:54:23 2018 +0100

     test 2 hilfe.txt
    

 2. reset the commit and discard all local changes

[USER@VM gitrepo]$ git reset --hard dbef962622cc6bc326bbcccb3e87332af7e9577a
HEAD is now at dbef962 test 2 hilfe.txt
  1. force pushing the commit to the master server and discard all changes on the master

    [USER@VM gitrepo]$ git push --force
    Total 0 (delta 0), reused 0 (delta 0)
    remote: From /home/git/gitrepo
    remote: + c846a35…dbef962 master -> origin/master (forced update)
    remote: Already up-to-date.
    To git@VM:/home/git/gitrepo/

    • c846a35…dbef962 master -> master (forced update)

Until now everything looks good.

Now to the Problem:

On my master server there is a folder called “cleartext”. I pull the commits automaticaly (from my master with the hooks - “post-update”) to this folder because I use it with my puppet server.

How my post-update looks like:

#!/bin/sh

### main ###
cd /home/git/cleartext/gitrepo
env -i git pull
env -i git clean -f -d

After forcing the push my commit ID’s from my client and my “cleartext” client are different. (And furthermore I can’t run a git pull on my “cleartext” client)

When I’m deleting the folder on my “cleartext” client and clone the git again there is no problem and the ID’s are equal. I don’t want to clone them every time.

What am I doing wrong?
How would you reset your local/master git repo to an older commit and discard all changes?

Thanks in advance.

Hi @jubimk4! I’m not sure I have an answer, but I might be able to help. Is the “cleartext” file a submodule?