ESSENTIAL COMMANDS - GIT/GIT HUB
Emmanuel Essien
Posted on November 22, 2024
WHAT IS GIT?
GIT is a free and open-source software for version control software for developers. This makes is easier for software developers to collaborate with each other for a coordinated work while developing a source code during software development
WHAT IS GIT HUB?
This is an internet hosting service for software development, unlike GIT that is Locally used only on a remote system. GIT HUB provides services such as; Git plus access control, bug tracking, software feature request, task management, continuous integration.
The following are some steps on how GIT commands are used on GIT BASH system, and some pictorial explanations.
WORKING WITH GIT BASH
1.GIT PUSH: This command is used to upload local repository content to a remote repository. (In Git, a local repository is a version-controlled directory on your local computer where your project files are stored, along with the metadata Git uses to track changes to these files.)
2.GIT COMMIT -M: This takes a snapshot of your repository at one point in time. The -m flag helps u add a message to the commit
3.GIT ADD: As the name implies it adds a change in the working directory to the staging area. It tells git that u want to include updates to a particular file.
4.GIT REMOTE ADD ORIGIN: This creates a new empty Git repository on your remote server.
PICTORIAL ILLUSTRATION AND HOW TO USE GIT COMMANDS
- Make sure you have GIT BASH downloaded or click on the link to download https://git-scm.com/downloads
Click On download for windows for windows users, other options are available for those using other versions of PC.
After your download u open the app it is going to be looking like this
- First step is to create an identity by configuring a name and email to Git BASH use the command
git config --global user.name "name"
git config --global user.email "email"
To Confirm We have successfully configure this, we use the list command: git config --list
- The next step is to configure your work environment. To do this we need to create a directory. After we are done with creating the directory we enter into it using the CD command.
- After done this we need to change the directory to a local GIT REPO so GIT can understand our command so we initialize the directory created earlier. We use the command git init
- Then we create an empty document (text file) using touch command. We use the command touch index.html
- Next we need to open the text file for editing we use VIM. Use the command** vim (name of the document)**
- To be able to edit we need to be in INSERT mode and to do this we hit i on the keyboard. We head to ChatGPT and search sample index.html resume then hit enter a number of codes will be shown the after we type UPDATE RESUME WITH FULL NAME. After making all the necessary changes you copy the html and paste
To save the file we press Escape Button, Shift and Column after that command we press WQ.
The next step is to clone our repo by signing into your GITHUB account click the plus symbol on the top right, then click on new repository, after that on the next page give the repository a name option ADD A README FILE click on it then go ahead to create a REPOSITORY. After succesfully creating a REPO the next page click on the top green option that show code. We are going to copy the URL.
- Next is to clone the REPO we created above, to do this we use the command git remote add origin (REPO URL)
- The next step is to bring whatever text file we created to the staging area we use a command:GIT ADD INDEX.HTML to prove that the file has been added we are going to use the GIT STATUS command
- Next we allow git to take a snapshot and push to git hub we use the command: git commit -m "commit message" the m there means message.
- The next step is to push that file to git hub. Use the command git push origin master after that you will be asked to sign into your GIT HUB account
- Head over to your repo u created on git hub to accept the pull request from git bash
- The next step u click on settings on the left hand side, click on pages now select the branch u deployed it from either MASTER/ MAIN u select master hit save and then refresh the page then a link will be created to show the website
Posted on November 22, 2024
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.