Hello again, friends! I hope that your Drupal learning journey is going well so far. I'm now almost midway through DrupalEasy's Drupal Career Online program and everything's been going great -- except for one recent setback. Although this setback was extremely annoying, I obtained a few takeaways in the process. I'll share what I've learned with you in the hope that you won't make the same mistake I did.
Having reached nearly the midway point of the course, I'd been feeling great about what I'd been learning, knocking out my homework, and even looking ahead to prepare for the upcoming week's lesson.
So on a recent Sunday night, with class on Monday, I decided to go ahead and set up my website, anticipating possibly having to share my screen during the lesson. I began the somewhat familiar process of setting up a Drupal site from my command line, and navigating to my sites directory where all of my previous class sites are saved. I used the
mkdir command to create a new directory for the week and called it dcowk6. Everything was going smoothly--until it wasn't.
What I should have done from there was navigate into the dcowk6 folder using
cd dcowk6 and then run the
ddev config command to begin the set-up process from there. What I actually did was begin the configuration process from my sites directory (the directory containing all my other class project websites). I continued the process, running the
ddev start command and following with
ddev composer create drupal/recommended-project. Little did I know I was making a big mistake.
At this point, the warning, "All existing content of the project root will be deleted" popped up, followed by the option to select "yes" or "no". This is where I should have slowed down and taken note of what directory I was in on my computer. It's so very important to know where you are before you begin this process (or any process for that matter) in the command terminal on your computer. (Using
pwd would have been a good idea at this point.) By running that last command from my sites directory instead of the appropriate dcowk6 directory, I deleted ALL of my previous class projects, along with all the homework I was so proud to be keeping up with and completing. I was devastated.
Luckily, the homework is mostly for practice and the previous sites aren't necessary to move forward in the class. But it hurt nonetheless. I've gone back and rebuilt some of the sites just to test out my skills. The silver lining in this whole experience is that I've been pleasantly surprised by how far I've come. The moral of the story? Always know where you are in your computer when using the command line.