PRO 30% Free • Stripe ($15) & Razorpay (₹899)

Push to GitHub

Top Course Staff · 2 min read · Web development · PRO · 30% Free Preview Available

Push to GitHub

Background

When developing an app, here’s a common approach:

  • You’re working with some new code to get it to work
  • You don’t want to break your existing code, so you copy your current code to another folder (Folder A) and continue working in Folder B
  • If you make a mistake, you just delete Folder B and resume with Folder A

This approach is the idea behindversion control. Version control is a process that lets you keep checkpoints of your code so that you can refer back to them if needed.

Gitis a widely-used version control system used to manage code. Code managed with Git is called aGit repository.

GitHubis popular hosting service for Git repositories. With GitHub, you can share your code and collaborate with others.

Instructions

  • In your project, initialize a Git repository:$ git initCopy to clipboard
  • Check the status of which files and folders are new or have been edited:$ git statusCopy to clipboard
  • Tell Git to start tracking your files and folders:$ git add .Copy to clipboardIf you want to track a single folder or file, use its name:$ git add app/ $ git add config/routes.rb
  • Verify that everything was committed correctly:$ git status
  • Save the changes you made, with a message describing what changed:$ git commit -m "Initial commit"
  • On GitHub, create a new repository with a short, memorable name:
  • After creating a repository, copy the git commands under the “…or push an existing repository from the command line”, and paste them into the terminal. These commands will add a remote repository, and then push your local repository to the remote repository.Want to learn more? Check out ourcourse on Git and GitHub.
$ git init
Copy to clipboard
$ git init
$ git status
Copy to clipboard
$ git status
$ git add .
Copy to clipboard
$ git add .
$ git add app/
$ git add config/routes.rb
$ git status
$ git commit -m "Initial commit"
New

New

Remote

Remote

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

30% Free Preview Reached · Unlock Remaining 70%

Complete Payment to Unlock Full Guide & Source Code

You are viewing the 30% preview. Join TopCourseAI Pro to unlock the remaining 70% of this article, unblur all code snippets, and gain full access to all 412 technical projects and guides.

✓ Full Access to All 160+ Projects
✓ Instant Blur Removal Everywhere
✓ Production Source Code & Blueprints
✓ All Future Deep Dives Included
Instant Unhindered Activation ·
End of Preview · Unlock Complete Blueprint & Source Code

Ready to access the complete step-by-step tutorial?

Gain full unhindered access to all 412 technical projects and guides, unblur all source code snippets, and download runnable scripts.

Production AI Blueprints

Ready to build production-grade AI systems?

Enjoyed this guide? Continue exploring our library of 166+ production blueprints, multi-agent swarms, and autonomous agent systems with 100% unblurred, executable source code.