I have been building my website with a git repository for a week. So far, I have not created any branches, but I just discovered a problem on my live site which needs to be fixed. Currently, I am two commits beyond the commit that contained my site as it was when I last pushed it from my dev environment to live last week. So here is what I did:
- I did
git checkout -b feature1
to create a new branch called 'feature1'
- I committed all of my current files.
- I did
git log
to find the hash number (afd6) of the commit that corresponds the that last live push/update.
- I did
git checkout afd6
At this point I expected my work space to only contain files and revisions that I committed last week. However, My work still contains all of the files and variations from today. Am I missing a step here? I am assuming that this operation should have removed all of the tracked files that did not exist within the earlier commit, and reverted all of the files that changed today.
edit ========================
I just did git clean -f -d
but nothing changed
edit =======================
git status says:
HEAD detached at afd620b
nothing to commit, working directory clean
edit =========================
Actually, I made a mistake in assuming that the files did not change because I was looking at each of the file's change date. I was expecting this data to change to 'last week' after checkout. Upon closed inspection, I saw that the files actually do contain last week's code, even though the data of modification still says 'today'. Could someone verify that git checkout
is considered to be a file modification by the operating system?