Terminal and Git
Module 1
What is Terminal?
Terminal allows the user to interact with the operating system by simpling typing commands. Below are the most popular commands that you should know.
lsshows all files/directories in the current directory
cd (directory_name)changes the path to the specified directory
touch (file_name)creates a file with the specified name
mkdir (directory_name)creates a directory (folder) with the specified name
What is Git?
Git is a program that allows you to save versions of your program using a commit. Commiting saves the whole snapshot of your project. So you can then revert back to the pervious commit if you mess up. Everytime someone on your team pushes code to git, you can pull their changes and keep updated.
Github is service that we’ll use. It allows you to save your program in the cloud so you can share with your friends, teammates, or anyone else in the world.
Activity
This activity will test your terminal and git skills by having you download a project from a github repository and then push the code to your own repository. Ensure that you have completed all the steps in the getting started guide.
- Open up terminal. Using the
cd Desktopcommand, navigate to your desktop - Using the
mkdir iCodeCampcommand, create a new folder - Change your directory to this new “iCodeCamp” directory
- Use the
git clone https://github.com/icodecamp/module1_personalWebsite.gitcommand to download the module1 code. Change your directory to the new folder that was downloaded. - On an internet browser, go to github and create a new public repository with the name “USERNAME.github.io” (replace the word username with your actual username). You do not neet to initalize with a “README.”
- Back to terminal! Use the command
git initto create a git repository. - The command
git add *will add all the files in the current directory to this new repo you just initialized locally. git commit -m "first commit"will commit this add to this new local repository.git remote set-url origin (URL_OF_YOUR_REMOTE_REPO)will connect your local repository to the remote one you created on github.com.- Final step! Run
git push -u origin masterto push your local commit to your remote repository.
Next Steps
Github lets each user have a free site. You created version one of your own site. Using sublime text, edit the contents of this website to your hearts desire. Then use the following commands git add, git commit, and git push commands to push these changes to github! If you ‘git’ stuck, here’s a link for a good resource.
Become an Expert
Interactive Command Line Tutorial. Stuck? Solutions
Interactive Github Tutorial. Stuck? Solutions
Interactive HTML and CSS Tutorial. Stuck? Solutions
General Assembly has numerous tutorial on creating reponsive websites and web games.