My Blog is Evolving...Into Something Else
Tags: discuss, showdev, career
Published: 2019-06-05 08:30:11

---
title: My Blog is Evolving...Into Something Else
published: true
description: DevInduct - A place where developers share their thoughts and experiences, good and bad, in purpose to improve themselves.
tags: #discuss, #showdev, #career
---

## Introduction

Not that long ago, I began my journey as a user on dev.to. The experience was and still is, a great one. The variety of discussions is vast, thus I was intrigued and wanted to be a part of it.

As a developer, I always strained towards practical knowledge, and my main focus was on the continuous improvement of the code I write. I started writing my articles in a more practical manner, with code samples in focus, providing fully working code at the end which turned out useful for developers.

![coding](https://images.unsplash.com/photo-1482062364825-616fd23b8fc1?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=500&q=60)

## The Changes

This led me to an idea to write even more code-oriented articles, and I added a cheat sheet section on my blog. You can check it out [here](https://devinduct.com/cheatsheets) later. At this point, it shows cheat sheets created by the site admins, but the plan is to add a search page for all publicly (because users can create a private one) accessible cheat sheets.

If you think about it, we are always googling for code samples, and it's not that rare the situation when we keep googling for the same thing over and over again because our brain cannot remember it.

![repeat](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRQRV8cp1oHxtP5a0KIHYrJ6peccmCQEVtNObJPQHSyLUx4si5krA)

I started thinking, what if we could keep it all in one place? What if we could write a code snippet somewhere, in our own coding style, and save it for the future reference? Not just that, we could store links found after hours of searching and googling on the web, links toward useful articles and much more...

I didn't want a repository, I didn't want an article, or anything too complicated, I just wanted to place a small helper function that I know it will be used again later.

The whole idea is to reduce the repetition we do on a daily basis and to have a personal knowledge database that can be shared with others or kept private.

![cheatsheet](https://images.idgesg.net/images/article/2019/02/crib-sheet_cheat-sheet_answers_tests_notes-100787270-large.3x2.jpg)

A future plan is to create team sheets, cheat sheets for teams to be managed and shared between the team members (if the cheat sheets prove as a useful feature of course).

At the same time, I've written a couple of articles that provided great value to the readers considering that one of them was read more than 25000 times and issued in the JavaScript weekly newsletter.

Newsletter [link](https://javascriptweekly.com/issues/438). It's the last one, *JavaScript Clean Code: Some Best Practices*
Article [link](https://devinduct.com/blogpost/22/javascript-clean-code-best-practices)

This led to users signing in and using the site, which made me feel great, because, in my opinion, there is nothing better than readers finding your writings valuable.

I was caught a bit off guard considering that I don't have features like comments section implemented, but it's coming up. In the end, I'm just an engineer wanting to help others and be a part of the ecosystem.

To keep this article code-oriented, as always, here is a Git commands sample cheat sheet:

## Initialization

- `git init`
- Creates an empty Git repository in the given directory. If it doesn't exist, the directory will be created.

```bash
git init <project-name>
```

- `git clone`
- Clones a repository located at the given URL onto the local machine.

```bash
git clone <project-url>
```

- `git config`
- Gets or sets the options for the current repository, or globally depending on the command.

```bash
# set up the credentials on a global level, meaning that every commit from the current machine will use the given user
git config --global user.name "John"
git config --global user.email "john@john.com"

# omit the --global option to set the configuration for the current repository only
git config user.name "John"
git config user.email "john@john.com"

# get local user name
git config user.name

# get global user name
git config --global user.name
```

## Files

- `git add`
- Updates the index using the current content found in the working tree, to prepare the content staged for the next commit. Depending on the options provided different actions will take place.

```bash
# adds the specified file to the index, where <file> is the file you want to add
git add <file>

# stages the specified files under the given directory, including files from the subdirectories
git add <directory>/\*.<extension>
git add pages/\*.html

# adds all new files to the index, ignoring modifications and deletions
git add .

# stages all changes in the working tree
git add -A
# or
git add --all

# stages modifications and deletions without adding new files found in the working tree
git add -u
# or
git add --update
```

- `git commit`
- Commits the staged changes.

```bash
# commits the changes with the given message
git commit -m "Super cool commit"

# replaces the last commit with the combination of the staged changes the changes from the last commit.
# if nothing is staged, this command can be used to update the last commit message.
git commit --amend -m "New super cool commit message"

# same as above except it doesn't change the commit message
git commit --amend --no-edit
```

- `git clean`
- Shows which files would be removed from the working directory or removes them, depending on the given option.

```bash
# show what would be removed
git clean -n

# do the cleaning forcefully
git clean -f
```

## Branches

- `git checkout`
- Changes your current branch to the one provided.

```bash
# switches to the given branch
git checkout <branch-name>

# creates a new branch and then switches to it
git checkout -b <branch-name>

# creates a new branch if it doesn't exist, otherwise resets it and then switches to it
git checkout -B <branch-name>

# copies the old branch and creates a new one with the same state
git checkout -b <branch-name> <old-branch-name>
```

- `git push`
- It applies the local changes to the remote branch.

```bash
git push origin <branch-name>
```

- `git pull`
- It applies the remote changes to the local branch.

```bash
git pull
```

- `git fetch`
- Retrieves the changes and branches committed by other team members.

```bash
git fetch origin
```

- `git merge`
- Merges two or more branches together.

```bash
# merges the <branch-name> into the branch you are currently working on
git merge <branch-name>

# to merge into a specific branch use checkout first
git checkout <branch-to-merge-to>
git merge <branch-name>
```

- `git branch`
- Used to list, create, or delete branches

```bash
# list all branches
# current branch will be highlighted with an asterisk
git branch --list

# list all merged branches
git branch -a --merged

# delete a branch
git branch -d <branch-name>

# delete a branch forcefully
git branch -d --force <branch-name>
# a shorthand
git branch -D <branch-name>
```

## Revisions

- `git show`
- Shows the information about the git repository. It can be used to show the information about commits, tags, trees, and blobs.

```bash
git show HEAD
```

- `git status`
- Shows the working tree current status. For example, if you want to see the currently staged files use this command.

```bash
# shows the current status
git status

# shows the current status in the short format
git status -s
```

- `git log`
- Shows the history of changes. The result includes data like commit id, date, and author.

```bash
# show the history
git log

# show the history by author
git log --author="Name"

# show the history by the commit message
git log --grep="Some Message"
```

- `git diff`
- Shows the difference between the working tree and the given branch.

```bash
git diff <branch-name>
```

## Reset and Revert

- `git reset`
- Reset the current branch to the specified state.

```bash
# this will undo/rollback the last commit.
# the commit is lost after this
git reset --hard HEAD~1

# to keep the changes use the --soft option
git reset --soft HEAD~1
```

- `git revert`
- Reverts the existing commits.

```bash
# this will open the system editor and prompts you to edit the commit message prior to committing the revert
# this is the default option
git revert

# in this case, the revert command will not open the editor
git revert --no-edit
```

An example regex cheat sheet can be found [here](https://devinduct.com/cheatsheet/10/regex).
Check out the full list [here](https://devinduct.com/cheatsheets).

I encourage you to go and create your first cheat sheet. Of course, you can write it in markdown. Let me know what you think in the comments below.

Thank you for reading and see you in the next article.