DEV Community

Cover image for A Step-by-Step Guide to Committing and Pushing Changes in Git Using Visual Studio Code
Nikhil Soman Sahu
Nikhil Soman Sahu

Posted on

A Step-by-Step Guide to Committing and Pushing Changes in Git Using Visual Studio Code

  1. Create a New Repository on GitHub:

    • Go to GitHub and log in to your account.
    • Click the "+" sign in the upper-right corner and select "New repository".
    • Give your repository a name, optionally add a description, choose visibility settings, and select any other desired options.
    • Click "Create repository".
  2. Initialize Git in Your Project:

    • Open your BMI calculator project in your preferred code editor (e.g., Visual Studio Code).
    • Open the terminal within your code editor.
  3. Initialize Git:

    • Run the following commands in the terminal:
     git init
     git add .
     git commit -m "Initial commit"
    
  4. Connect Your Local Repository to GitHub:

    • Copy the URL of the repository you created on GitHub.
    • Run the following command in the terminal, replacing <repository-url> with the actual URL:
     git remote add origin <repository-url>
     git branch -M main
     git push -u origin main
    
  5. Push Your Code to GitHub:

    • Run the following command to push your code to GitHub:
     git push origin main
    
  6. Your Code is on GitHub:

    • Refresh your GitHub repository page, and you should see your code uploaded.
  7. Updating Your Repository:

    • Whenever you make changes to your code, you can use the following commands to update your GitHub repository:
     git add .
     git commit -m "Update"
     git push origin main
    

Remember to keep your sensitive data (like API keys) out of your public repositories. You can use environment variables or other methods to manage such information securely.

Please note that this is a general guide. Make sure to refer to official documentation or tutorials for more detailed instructions tailored to your specific development environment and tools.

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay