YUHEE1984 / CatsOneday

1 stars 0 forks source link

01 - Getting Started #1

Closed TheBeege closed 3 months ago

TheBeege commented 3 months ago

Goal

Setup your workspace for the project.

Steps

Downloading the Project

The below steps will "clone" this Git repository to your computer. It will copy what's on Github to your computer and maintain a link between the Git repository on your computer and the Git repository on Github.

  1. On the Code page for this repository, click the big, green Code button. image
  2. Click the copy URL button. image
  3. In your terminal, enter git clone then Cmd+v to paste the URL, then hit enter.
  4. Enter cd CatsOneday to enter your project directory.

Hello World

The below steps will make sure you can run some code. We'll assume that you've already navigated to your project directory (step 4 in Downloading the Project).

  1. Create a new file, Main.java. If you're using the terminal, you can do this with touch Main.java.
    1. Alternatively, if you skip to step 2, vim will create the file when you save it.
  2. Edit the file with vim Main.java, like you're already familiar with.
  3. Create your main function in a Main class, just like you've done before.
  4. In your main function, print out Hello world!.
  5. Save! And exit.
  6. Use javac and java to run your program like normal.

Committing and Pushing

Great! You have something working. Now, you should copy your code up to Github just in case your notebook explodes or something. Backup early; backup often.

  1. Run git add -A to add "stage" all the files in the current directory.
    • What's staging? Staging tells Git that we plan to save these changed files permanently. Staging is separate from permanent saving (called "committing") because you may not want to commit every file every time.
  2. Run git commit -m 'Prints hello world!' to permanently save your changes with a descriptive message. This is called a "commit."
    • You can run git log to see a history of all your commits. Hit q to exit once you're done looking through it.
  3. Run git push to save all of the commits in your project back to Github.
  4. Go to this project's page (link for convenience) to see your new Main.java file in the Github repository.

Great work! You've made the first, important steps on this project. Ready for some cats?

YUHEE1984 commented 1 day ago

Reviewed this.