Push To GitHub - Codecademy

Skip to ContentArticle Categories Menu →Related Topics
  • Web development
  • Related learning
  • Learn Git: Introduction
  • Using Git for DevOps: Using Git Effectively
  • Learn Git & GitHub
  • View more
  • ArticlesPush to GitHubCodecademy TeamShare

    Related learning

    • Free course

      Learn Git: Introduction

      Learn how to track changes in your code and switch between different versions with Git, an open-source version control system.
      • Checker DenseBeginner Friendly.1 hour
    • Free course

      Using Git for DevOps: Using Git Effectively

      Become proficient in Git for DevOps, including repository management, Git commands, GUI, distributed workflows, branching, Git server protocols, and Gitflow.
      • Checker DenseIntermediate.1 hour

    Background

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

    1. You’re working with some new code to get it to work
    2. 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
    3. If you make a mistake, you just delete Folder B and resume with Folder A

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

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

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

    Instructions

    1. In your project, initialize a Git repository:

      $ git initCopy to clipboard
    2. Check the status of which files and folders are new or have been edited:

      $ git statusCopy to clipboard
    3. Tell Git to start tracking your files and folders:

      $ git add .Copy to clipboard

      If you want to track a single folder or file, use its name:

      $ git add app/ $ git add config/routes.rb
    4. Verify that everything was committed correctly:

      $ git status
    5. Save the changes you made, with a message describing what changed:

      $ git commit -m "Initial commit"
    6. On GitHub, create a new repository with a short, memorable name: New

    7. 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. Remote Want to learn more? Check out our course on Git and GitHub.

    Checker DenseCodecademy Team

    '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.'

    Meet the full team Share

    Related articles

    • Article

      Set Up with Git and GitHub

      Learn how to install Git, configure it, and connect to GitHub to manage your code with version control and collaboration.
    • Article

      Git Setup for Mac and Windows Computers

      Never fear losing work with this professional versioning system
    • Article

      How to Use Git: A Step-by-Step Tutorial

      Learn how to use Git efficiently to track changes in your code, collaborate with others, and simplify your development process. Master version control with our step-by-step guide!

    Learn more on Codecademy

    • Free course

      Learn Git: Introduction

      Learn how to track changes in your code and switch between different versions with Git, an open-source version control system.
      • Checker DenseBeginner Friendly.1 hour
    • Free course

      Using Git for DevOps: Using Git Effectively

      Become proficient in Git for DevOps, including repository management, Git commands, GUI, distributed workflows, branching, Git server protocols, and Gitflow.
      • Checker DenseIntermediate.1 hour
    • Course

      Learn Git & GitHub

      Use our beginner friendly Git course to integrate Git and GitHub and manage versions of your projects using Git branches.
      • Checker DenseWith Certificate
      • Checker DenseBeginner Friendly.4 hours

    Tag » How To Push In Github