The Beginner’s Guide to Git & GitHub

Image for post
Image for post
Source

What is Git?

Image for post
Image for post
Shows how Git works as VCS. Source

Git Repositories

Before using Git & GitHub we should know why we need it?

Now we’ll learn how to use Git & GitHub

Image for post
Image for post
$ sudo apt update
$ sudo apt-get install git
$ git --version
$ git config --global user.name "MV Thanoshan"
$ git config --global user.email "example@mail.com"

Working with GitHub projects

Type 1: First creating the repository , clone it to PC and work on it

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
$ git clone [HTTPS ADDRESS]
Image for post
Image for post
$ cd [NAME OF REPOSITORY]
Image for post
Image for post
$ cd [NAME OF REPOSITORY]
$ git status
Image for post
Image for post
$ git add [FILENAME] [FILENAME] [...]
$ git add sample.html
Image for post
Image for post
$ git commit -m "Added sample HTML file that contain basic syntax"
Image for post
Image for post
$ git remote
Image for post
Image for post
$ git push origin master
Image for post
Image for post
:q
Image for post
Image for post
Image for post
Image for post

Type 2: Work on your project locally then creating the repository on GitHub and pushing it to remote.

Image for post
Image for post
$ git init
Image for post
Image for post
$ git status
Image for post
Image for post
$ git add [FILENAME] [FILENAME] [...]
Image for post
Image for post
$ git commit -m "Adding web Survey form"
Image for post
Image for post
Image for post
Image for post
Image for post
Image for post
$ git remote add origin [HTTPS ADDRESS]
$ git remote
$ git push origin master
Image for post
Image for post

Conclusion

References

Hard work and perseverance is something we can control, so take action and practice — Christine Alvarado.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store