Utility Belt

Download this Project @ GitHub


Posted on October 11, 2020 UPDATE - CHECK OUT THE GIT FLIGHT RULES


Hacktoberfest

Hacktoberfest

Hacktoberfest® is a free global event to celebrate and support open source development. Whether you’re a developer, student learning to code, event host, or company of any size, you can help drive growth of open source and make positive contributions to an ever-growing community. All backgrounds and skill levels are encouraged to participate.

I decided to join the fun and created a basic simple console application in C#. The source code is hosted on Github and is open to the public. It has been amazing to watch as this project has grown from the many contirbutions from users all across the globe. Let's get to how you can contribute too and then we can circle back and highlight on the amazing contributors and what they added to the project.


git

Get Git

Get Git depending on the Operating System (OS) you are using. The links above go into great detail with exact steps in how to get you going. Git is an open source version control system that works locally to help developers work together on software projects that matter. Here is a quick reference to commands that are useful for working and collaborating in a Git repository (repo).

github

Github

Create a free account at Github. Open up a new terminal or command prompt at the parent folder you want to house your projects. A shortcut for Windows users is from the File Explorer, at the top where the file path is shown, type in cmd and hit enter.

fileShortcut

cmdShortcut

From command prompt, clone the repo:

git clone https://github.com/aherd2985/UtilityBelt.git

Then create a new branch for yourself:

git checkout -b simpleChange

Make some code changes and then run this command to see what files changed:

git status

You can copy/paste the file names you want included in your commit.

git add { fileNamne }

If every file you want to commit is showing and there isn't any extra fat, you can add them all at once.

git add --all

Add a message for your commit

git commit -m "made that change boss"

Commit your branch using the branch name you are on:

git push origin simpleChange
gitPush

Go to GitHub and navigate to the main page of the repository. In the "Branch" menu, choose the branch that contains your commits. Above the list of files, click Pull request. Use the base branch dropdown menu to select the branch you'd like to merge your changes into, then use the compare branch drop-down menu to choose the topic branch you made your changes in. Sometimes you can click 'Compare & pull request' from the main repository. Fill in as much as you'd like and update the labels, issues, etc to specifics. Click the green 'Create pull request' button.

comparePull

createPull

This allows the repo's maintainers to review your contribution. From here, they can review files, merge it if it is good, or they may ask you to make some changes.

reviewMerge


This open source Utility Belt project has had 28 unique contributors working together from Poland, Honduras, Russia, UK, Italy, Lithuania, India, and United States completing over 60 pull requests. Contributors have setup Unit Tests, Logging, Parallelism, System.Composition-based architecture, ASCII loading art, and 32 individual different utilities. The project has the utilities separated out and is easy to contribute to without the likely risk of merge errors. It has been an evolving project that has built a solid foundation encouraging modular building for any direction a C# library would want to go. The collaboration has been inspirational in showing what teams can achieve when working together.

utilityMenu


Git Cheat Sheet

Initializing

Starting up Git within a project and getting it connected.


git init

Initializes (or starts) your current working directory (folder) as a Git repository (repo).


git clone https://www.github.com/username/repo-name

Copies an existing Git repo hosted remotely.


git remote git remote -v

Shows your current Git directory’s remote repo. Use the -v flag for more info.


git remote add upstream https://www.github.com/username/repo-name

Adds the Git upstream to a URL.

Branching

Isolating work and managing feature development in one place.


git branch

Lists all current branches. An asterisk ( ) will appear next to your currently active branch.


git branch new-branch

Creates a new branch. You will remain on your currently active branch until you switch to the new one.


git checkout another-branch

Switches to any existing branch and checks it out into your current working directory.


git checkout -b new-branch

Consolidates the creation and checkout of a new branch.


git branch -d branch-name

Deletes a branch.

Staging

Creating files staged after modifying a file and marking it ready to go in the next commit.


git status

Checks the status of your Git repo, including files added that are not staged.


git add . git or add my_script.js

Stages modified files. If you make changes that you want included in the next commit, you can run add again. Use git add . for all files to be staged, or specify specific files by name.


git reset my_script.js

Removes a file from staging while retaining changes within your working directory.

Collaborating and Sharing

Downloading changes from another repository or sharing changes with the larger codebase.


git push origin main

Pushes or sends your local branch commits to the remote repo. Note: some repos use master instead of main in their commands.


git pull

Fetches and merges any commits from the tracking remote branch.


git merge upstream/main

Merges the fetched commits.

Committing

Recording changes made to the repo.


git commit -m "Commit message"

Commits staged files with a meaningful commit message so that you and others can track commits.


git commit -am "Commit message"

Condenses all tracked files by committing them in one step.


git commit --amend -m New commit message

Modifies your commit message.

Showing Changes

See changes between commits, branches, and more.


git diff --staged

Compares modified files that are in the staging area.


git diff a-branch..b-branch

Displays the diff of what is in a-branch but is not in b-branch.


git diff 61ce3e6..e221d9

Uses commit id to show the diff between two specific commits.


Secure Shell (SSH)

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network. SSH provides a secure channel over an unsecured network by using a client–server architecture, connecting an SSH client application with an SSH server. SSH uses public-key cryptography to authenticate the remote computer and allow it to authenticate the user. There are several ways to use SSH; one is to use automatically generated public-private key pairs to simply encrypt a network connection, and then use password authentication to log on. OpenSSH is included in Windows 10. Open a command prompt and enter this command:

ssh-keygen

Create a password and re-type it for confirmation.

sshKeygen

Open the new public key you created and copy the contents.

sshKey

Go to your settings in GitHub and click on the tab for 'SSH and GPG keys. Then click 'New SSH Key'.

addSSH2git

Paste the contents of the public SSH key that was generated.

addSSH

You will be redirected back to the Settings page and see the newly created SSH key.

sshSave