DEV Community

Cover image for Push to GitHub as a Pro
Usenmfon
Usenmfon

Posted on • Edited on

Push to GitHub as a Pro

GitHub is one of the most popular version control systems being used among developers for collaborations, future referencing, versioning, and other purposes.
This article illustrates one of many ways to commit and push changes to a remote repository.

Requirements:

CREATE A NEW REPO:

  • login to github
  • create a new repository
  • give the repository a name
  • tick the add readMe checkbox
  • click on Create repository
  • click on the code drop down (far right hand side)
  • copy the https link provided

set-up-repo


ON THE LOCAL MACHINE (PC):

  • select where to save the new repo
  • click on the location path at the top section the screen
  • type "powershell" on the path
  • press enter key

POWER SHELL CONSOLE

  • type git clone command and paste the copied link
git clone the_copied_github_link
Enter fullscreen mode Exit fullscreen mode
  • press the enter key
  • change the directory to the newly cloned repository
cd the_name_of_the_repo
Enter fullscreen mode Exit fullscreen mode
  • press the enter key

OPEN FOLDER IN VS CODE

  • type on the console
code .
Enter fullscreen mode Exit fullscreen mode
  • press enter key

clone-to-machine

The only file in the repo is a README file, go ahead and create any file (like html, css, etc.) or folders in it.


PUSH TO GITHUB

add-new-file

  • open the vs code terminal and type the following commands:
    1. To add the new changes
  git add .
Enter fullscreen mode Exit fullscreen mode
  1. To commit the new entries
  git commit -m 'a descriptive message of what was done'
Enter fullscreen mode Exit fullscreen mode
  1. To push to remote repository
  git push origin main
Enter fullscreen mode Exit fullscreen mode

Visit the newly created remote repo. Voila! the new changes have been updated, Congratulations.

Top comments (0)