“A Very Particular Set of Skills…”

Kenny Brast
6 min readDec 6, 2022

This Git thing is sort of a big deal. Time to go Fork, Clone, Push & Pull to see what all the fuss is about!

What is Git?

Git is a DevOps tool used for source code management. It is a free and open-source version control system used to handle small to very large projects efficiently. Git is used to tracking changes in the source code, enabling multiple developers to work together on non-linear development.

What is GitHub?

GitHub is a for-profit company that offers a cloud-based Git repository hosting service. Essentially, it makes it a lot easier for individuals and teams to use Git for version control and collaboration.

A few prerequisites to get started.

Know the basics of Git and GitHub.
Know the basics of the Linux command line and a text editor such as vim.

Create a GitHub Account: https://docs.github.com/en/get-started/signing-up-for-github/signing-up-for-a-new-github-account

Install Git on a Linux server. We are using a CentOS 8 distribution (distro).

Create a GitHub personal access token: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

Time to Fork the Repo!

A fork is a copy of a repository that you manage. Forks let you make changes to a project without affecting the original repository.

First, a copy of the original GitHub repository needs to be created on your own GitHub account. Navigate to the target repository to be copied. Click the button in the top right corner labeled Fork.

Your local repository needs a new directory.

Making a new local directory keeps everything nice and organized for the files to be worked on. The new directory here will be named teamlu as the working example. Run the mkdir command:

mkdir teamlu

Now change into this new empty directory by running the cd command:

cd teamlu

It’s time to CLONE that Forked Repo!

Earlier, a copy of the original repository was created to be worked on. This copy exists on your GitHub account. A local copy of the forked repository is needed on your Linux server. This will allow a sync between GitHub and your server. To make this happen, a clone will need to be created. On the right side of the GitHub dashboard, look for the green <> Code button. Click the down arrow of the green <> Code button, and a box will display with the HTTPS clone address. Copy this address for use in the next step.

Now on your Linux server local terminal, run the git clone command to create the clone:

git clone <URL copied from HTTPS clone address>

From within the teamlu directory run the ls command to confirm the cloned repository is present. LevelUpTeam is the name of the cloned repo.

[cloud_user@6d124f4e9g3c teamlu]$ ls
LevelUpTeam

The clone can now be edited. We are going to change to the directory of the clone repository by running the cd command, then use the ls command to view the contents of the directory.

[cloud_user@6d124f4e9g3c teamlu]$ cd LevelUpTeam/
[cloud_user@6d124f4e9g3c LevelUpTeam]$ ls
badges linux.sh READ.md READ.md.LUIT

Select a file to edit using a text editor, for which we will use vim here. Our file choice to edit is linux.sh.

vim linux.sh

Make the changes you want in the file. From vim, hit the escape key, then enter :wq to save + exit. Run the command git status to confirm modifications were made to the file.

[cloud_user@6d124f4e9g3c LevelUpTeam]$ git status
# On branch main
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory
#
# modified: linux.sh
#
no changes added to commit (use "git add" and/or "git commit -a")

This confirms that linux.sh was modified, but no changes were committed.

It’s now necessary to Commit the file.

Git expects to know the changes made for the file commit. A simple message that pertains to the changes made will let your team know what actually changed. The commit is made by running git commit with the -a option to add changed files to staging, and the -m option to add your change message.

git commit -a -m "your change message here"

The changes have been successfully made to the cloned repository, with the changes committed.

Time to Push the updates back to GitHub!

The commits are ready to be pushed to GitHub. Setting up a remote is not needed because the clone is from an existing repo and an existing branch. To proceed, the git push origin command is run.

git push origin <name of the remote>

You will now be prompted for your username and password. The GitHub personal access token created at the beginning of this article will be used in place of your GitHub password.

[cloud_user@6d124f4e9g3c LevelUpTeam]$ git push origin main
Username for 'https://github.com': kbrast
Password for 'https://kbrast@github.com':

After the password is entered and the push is successful, you’ll see:

Counting objects: 5, done
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 294 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/kbrast/LevelUpTeam.git
c8a13da..3236b15 main -> main
[cloud_user@6d124f4e9g3c LevelUpTeam]$

Now it’s time to go back to your GitHub account and the repository being used. By refreshing the window, you should now see the comments made. Here, the file linux.sh now has a comment of ‘changed name’.

Finally, we send a Pull Request to Merge the Commits with the original Repo!

The Pull Request (PR) notifies your team that the commits are completed and directs the owner of the repository to merge the commits with the original. Click the Pull requests button located towards the upper right corner of the GitHub page .

Click on the green button for New pull request:

Next, click on the green button for View pull request:

Pull request confirmed!

Summary

You have learned how to fork and clone another repository, make and save edits, commit and push the changes back to GitHub, and request that the repository owner merge the commits to the main branch. You now possess “a very particular set of skills…”

Level Up In Tech!

--

--