I'm very new to this git thing, and as far as my experience goes, I've never encountered something like this before.
I've multiple local branches that I frequently switch around with, since I work with a group, and use other branches as a reference.
In this case, one of my friends committed and pushed something to his branch, and he suggested we have a look-see.
So I committed my changes on my own branch, but as usual, there are those Xcode files that magically edit themselves whenever we just open them, so I thought it would be a good idea to just git stash
them (after the commit) and deal with them later, just so I can checkout my friend's branch and fetch the update.
After that was done, I switched back to my branch, and did git stash pop
, and checked-out said files that aren't really important.
Then I noticed the files I created are gone.
I tried to do a git revert
but it did nothing, not that I understood what happened, anyway.
Here's the list of commands I put in:
git add Integra-Geochemistry/Controllers/WaterSamplingFormOneViewController.swift
git add Integra-Geochemistry/Views/WaterSamplingFormOneView.swift
git add Integra-Geochemistry/Xibs/WaterSamplingFormOne.xib
git status
git commit -m "Initial commit - added WaterSamplingForm"
git status
git branch
git branch dev/surface-thermal-sampling
git checout dev/surface-thermal-sampling
git checkout dev/surface-thermal-sampling
git stash
git status
git checkout dev/surface-thermal-sampling
git pull origin dev/surface-thermal-sampling
git branch
git status
git branch
git checkout dev/watersampling
git status
git stash pop
git checkout Integra-Geochemistry/Xibs/AddRadonFormView.xib
git checkout Integra-Geochemistry/Xibs/RadonReadingFormFourView.xib
git checkout Integra-Geochemistry/Xibs/RadonReadingFormThreeView.xib
git checkout Integra-Geochemistry/Xibs/RadonReadingFormTwoView.xib
git checkout Integra-Geochemistry/Xibs/RadonReadingFormView.xib
git log
git revert 63947089d3479fff91ae4fb2ba5d59bd39d0c30d
For reference, here's the log file (after I did the git revert)
commit 8f5a3b8a4db5bad0a750ba08cd2d5b6a8a2fe18e
Author: <-------->
Date: Tue Jan 5 17:28:19 2016 +0800
Revert "Initial commit - added WaterSamplingForm"
This reverts commit 63947089d3479fff91ae4fb2ba5d59bd39d0c30d.
commit 63947089d3479fff91ae4fb2ba5d59bd39d0c30d
Author: <-------->
Date: Tue Jan 5 17:13:35 2016 +0800
Initial commit - added WaterSamplingForm
I've done a lot of committing, pushing and switching branches, but I never had anything disappear on me like this.
Is there any chance my files are okay and recoverable? I'd hate to start over. Thanks.