In this module, we'll dive into the fundamentals of the command line, a powerful tool that will empower you to work your coding wizardry.
The command line, often referred to as the "command prompt," "terminal," or "CLI" (Command Line Interface), is your backstage pass to interacting with your computer in a way that goes beyond clicking and dragging. It's where the real magic happens.
- MacOS: To access the Terminal, navigate to
Applications
>Utilities
>Terminal
. - Windows: Click
Start
, thenAll Programs
>Accessories
>Command Prompt
.
Let's start with some essential commands to navigate this new territory:
- MacOS: Type
pwd
and press Enter. - Windows: Use
cd
and press Enter.
- MacOS: Type
ls
and press Enter. - Windows: Use
dir
and press Enter.
- Create a new directory called "VetsWhoCode" by typing
mkdir VetsWhoCode
and pressing Enter.
- Move into your new directory with
cd VetsWhoCode
and press Enter.
- To return to the previous directory, simply type
cd ..
and press Enter.
- In MacOS:
rm -r NameOfDirectory
- In Windows:
rmdir /S NameOfDirectory
Now that you've got the hang of the command line, let's introduce you to your trusty sidekick: the code editor. An Integrated Development Environment (IDE) is your go-to software for writing, debugging, and deploying code. Our favorite is Visual Studio Code. Download it here and supercharge it with our VetsWhoCode Extension Pack.
We recommend using Google Chrome for its powerful developer tools. Download it here and embark on your web development journey.
Git and GitHub are essential for collaboration and version control. Here's how to get started:
-
Install Git: Download and install Git for Windows from the official Git website.
-
Configure Git: Open Git Bash and set your name and email using these commands:
git config --global user.name "Your Name" git config --global user.email "[email protected]"
-
Create the repository: Start by creating a new repository. Click "New" and follow the prompts.
-
Clone the repository: Copy the repository URL from the "Code" button and follow these steps to clone it to your local machine:
- Open your terminal or command prompt.
- Run
git clone URL-Goes-Here
-
Start coding: Open the cloned repository in your favorite code editor, such as Visual Studio Code. It's just like working with a regular folder. Make changes to files, create or delete folders, and let your creativity flow.
-
Stage your changes: You need to let
git
know what changes you made. To add your changes to the staging area, typegit add
followed by the file name or directory you want to add. You can usegit add .
to add all the changes. To check what changes are staged you can rungit status
. In the output the file names in green are the staged changes.
-
Commit changes: Once you have added your changes to the staging area, you can commit them by typing
git commit -m "<commit message>"
followed by a meaningful message describing what changes were made. -
Push changes: Upload your changes to the GitHub repository by typing
git push
. If your branch isn't setup, check the output in the command line. It may have a message likegit push --set-upstream origin <branch name>
. Once you've set your upstream, you can usegit push
for all future uploads to this branch. -
Pull changes: To update your local machine with changes made elsewhere, run
git pull
. -
Create a pull request: If you want to suggest changes to someone else's repository, create a pull request via the "Pull request" button on their repository page.
-
Merge your changes: The repository owner can merge your changes by clicking the "Merge pull request" button.
Now, you're armed with the knowledge and tools to embark on your web development journey. Get ready to create, innovate, and make your mark on the digital world! 🚀