• Contact Us
  • Home
  • Reference

Git Commands and GitHub

Learn essential Git commands and how to use GitHub effectively for version control and collaboration in software development projects.

Written by Lenka Klementova

Updated at July 2nd, 2025

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

Installing Git and Cloning a GitHub Repo Making Changes and Committing Them

Git is a version control system that is used locally and can track and store different versions of a project in development. Its commonly used counterpart, GitHub, is a remote storage for hosting and sharing the code. This article will explain some commonly used commands for operating git and communicating code between local Git repositories and remote GitHub repositories. 

Installing Git and Cloning a GitHub Repo

First choose the appropriate package management system, and install git locally, e.g.:

Fedora/RedHat/Centos:

sudo dnf install git-all

Debian/Ubuntu:

sudo apt install git-all

Next import (clone) the remote repository from GitHub to your local folder in order to work with it:

  1. Find the repository page online on GitHub
  2. Click on the green button that says “Code” and copy the repo's URL
  3. In your command line navigate to the desired location for your local repository 
  4. Clone the remote repository to the local location:
git clone <url>

The folder structure from the GitHub repo will be copied.

Making Changes and Committing Them

In order to create a “version” the changes made need to be staged and then commited:

1. Check the status of your local repo. The git status command:

git status

will list all files that have been updated and/or staged. 

2. Select the files (changes) that you want to be committed. Use:

git add <file>

to stage a changed file. If you have a staged file that you don't want to commit use

git restore <file>

3. Run: 

git status

again to make sure those (and only those) files that you want to be committed are staged.

4. Run:

git commit 

to commit your staged changes. You will be directed to add a commit message. Alternatively you can use:

git commit -m “<message>” 

as a shortcut.

5. You can check your commit history by running:

git log

 

 

 

 

 

Pushing and pulling changes between local and remote repositories

To push your local commit onto the remote GitHub repository run git push command. You will need to specify the remote name - typically “origin”, and the branch name - by default “main” or “master”. 

git push origin master

To pull changes made on the remote GitHub to your local repository use git pull

 

For more information including information about branching please check the official documentation on https://git-scm.com/docs

Copyright © 2020-2024 Symas Corporation. All rights reserved.
code instructions git commands

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Using ldapsearch
  • Configure LDAP Client on Ubuntu
  • Configuring iptables (Opening LDAP Ports)
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2023, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand