DEV Community

Cover image for Introduction to Gitbash and Github
LILIAN GATHONI
LILIAN GATHONI

Posted on

Introduction to Gitbash and Github

Definitions

Git is a widely used, free, and open-source system designed to handle projects of all sizes. It enables developers to track changes in code for development projects and also fosters collaboration.
Bash is the name of a default shell in MacOs and Linux.
This means that Gitbash is a command-line interface for Microsoft Windows that provides a Unix shell environment for using Git.
Gitbash is locally installed on personal computers.
GitHub is a cloud-based platform where we store, share, and work together with others to write code.

Installation process of Gitbash

  1. Download the appropriate installer for your operating system from the official Git website. git link

  1. Click on download and urn the downloaded executable file.
  2. Follow the prompts in the setup wizard and carry out the necessary configuration to install gitbash.
  3. Click install to complete the process.
  4. For verification whether the installation was done correctly, verification of the GitBash version is done on the command prompt using the code below. The correct output specifies the Git version downoaded;

$ git --version

  1. The final step is to configureyour name and email address

$ git config --global user.name "name"

$ git config --global user.email "email"

Linking of Gitbash and GitHub account

Linking the Git and GitHub accounts is done by adding an SSH key to the GitHub account. This takes git to a higher level as it allows collaboration by team members, accessibility, and automation through a web-based platform

Pushing and Pulling code using git

Git pulling refers to fetching the content from a remote repository and updating the content to match the local repository.

Pulling steps

  1. Make sure you are on the local branch you want to commit the change.
  2. Pull the changes by running the command below git pull The git pull command is a combination of 2 commands; git fetch- This downloads content from the remote repository git merge-It merges the new remote content into a new local merge commit 3.Commit changes to push to repository

Git push is uploading the local repository content to a remote repository
Before pushing, it's necessary to ensure that you have a local repository with committed changes.

Steps to git push

  1. Push committed changes using the git push origin main command. Origin refers to the default name of the remote repository and main refers to the name of the branch you are pushing to.
  2. Enter credentials when needed.
  3. Verify the push by refreshing your remote repository on github.

Tracking changes

This is done using 3 core commands.
git status - This command provides a summary of the state of your repository. It includes information on which files are modified, unmodified, untracked, or staged.
git add - Adds changes to your working area to your staging area, which is a picture of changes highlighted for the next commit.
git commit - Records the changes permanently in the local repository. The message displayed is a summary of the changes and the reasons behind them.

Version control

Version control is a system that records changes to a file or set of files over time, allowing recall of specific versions later.

Importance of version control

  1. A complete long-term history of changes made in the file.
  2. Branching and merging- This allows individuals in a team to work on different streams of changes, and they can still merge the work afterwards.
  3. Can easily trace any changes made in the repository.

Top comments (1)

Collapse
 
avedi profile image
Owen Avedi

Insightful!!