Skip to content

Commit

Permalink
some update to my blog
Browse files Browse the repository at this point in the history
  • Loading branch information
Oluwasetemi committed Jul 31, 2024
1 parent b0a6d25 commit 03cafc4
Show file tree
Hide file tree
Showing 12 changed files with 53 additions and 57 deletions.
Binary file modified bun.lockb
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ including access to `gh api` itself. All the API endpoints both the rest version
developer experience. The `gh` command is among my top 10 most used CLI
commands. Let me share some of the `gh` command i cannot do without.

```sh=
```bash
# install Github CLI today, right away.
# https://cli.github.com/ and start saving time.

Expand All @@ -141,7 +141,7 @@ directly from my terminal using the netlify-cli or ntl for short.

Here are some of the command line I run with netlify-cli.

```sh=
```bash
ntl open:admin

ntl open:sites
Expand All @@ -165,13 +165,13 @@ transformations and optimizations.

I need to upload an image and get a URL copied to my clipboard.

```sh=
```bash
cld uploader upload bejamas.png folder=personal use_filename=true | jq '.url' | pbcopy
```

Showing few commands on how to set up cld on your computer.

```sh
```bash
pip3 install cloudinary-cli
# requires python to be installed

Expand Down Expand Up @@ -204,7 +204,7 @@ helps me to install and manage several versions of nodejs.

[For installation of nvm on your computer check this link](https://github.com/nvm-sh/nvm#installing-and-updating).

```sh
```bash
$ nvm use 16
Now using node v16.9.1 (npm v7.21.1)
$ node -v
Expand All @@ -223,7 +223,7 @@ The common use case I run into always is having globally installed packages that
I need to carry along to a new version installed. The script below helps me to
do this conveniently.

```sh
```bash
# allow me to carry over my global npm package after any change of version

nvm_use (){
Expand Down Expand Up @@ -259,7 +259,7 @@ get talked about a lot of time but it helps you save time on repeated commands.

To alias git with g:

```sh
```bash
alias g='git'
alias ga='git add'
alias gaa='git add .'
Expand All @@ -268,7 +268,7 @@ alias gaa='git add .'
Instead of git, I can type g and it will behave like I used git. For file and
folder manipulations try this.

```sh
```bash
alias ~='cd ~'
alias .='cd ..'
alias ..='cd ../..'
Expand All @@ -290,7 +290,7 @@ This helps me abstract git add, git commit and git push. It was taken from one
of the open-source works of [Ahmad Awais](https://github.com/ahmadawais) called
[emoji-log](https://github.com/ahmadawais/Emoji-Log).

```sh
```bash
# Git commit, Add all
function gcaz() {
git add . && git commit -m "$*"
Expand All @@ -308,7 +308,7 @@ have used before but cannot remember. It saves you the effort of googling. You
may increase the history size to increase the number of commands that can be
saved.

```sh
```bash
# history size
HISTSIZE=7000
HISTFILESIZE=14000
Expand All @@ -328,7 +328,7 @@ setopt HIST_IGNORE_DUPS

This function will return a list of frequently used cli commands.

```sh
```bash
# List the 10 most frequently used command
function historyTop () { history | awk '{print $2}' | sort | uniq -c | sort -rn | head -10 }

Expand Down
38 changes: 19 additions & 19 deletions content/blog/git-with-hub-like-github-part-2/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Add missing remotes prior to performing git fetch. Allow space separated list of
remotes you want to fetch with a flag (--multiple). You can update more than one
remote with a single command.

```sh
```bash
hub fetch <remote-name>
# equivalent with GitHub
# add the remote-name and fetch the remote-name
Expand All @@ -45,7 +45,7 @@ hub fetch staging oluwasetemi/feature oluwasetemi/test
Initialize a git repository and add a remote pointing to GitHub.By the time you
run the command , it would have run `git init`, `git remote add`

```sh
```bash
hub init -g

# git equivalent
Expand All @@ -65,7 +65,7 @@ text like `Merge pull request #Number from branch ....`. Hub is very beautiful
and it simplify the process most especially if you do not want to leave your
command-line interface.

```sh
```bash
hub merge <pull-request-url>
```

Expand All @@ -82,7 +82,7 @@ status will be turned to merged.
Push a git branch to each of the listed remotes.Accept more than one listed
remote.

```sh
```bash
hub push <remote>, <remote2>

# git equivalent is running git push <remote> <remote2>
Expand All @@ -95,7 +95,7 @@ remote is the api i.e you only add the remote name as against the remote url
with git. So it means the hub goes to GitHub and find the remote you're
inferring and it is added.

```sh
```bash
hub remote add <remote-name>

# git equivalent
Expand All @@ -109,7 +109,7 @@ Git repositories nested inside a parent Git repository at a specific path in the
parent repository's working directory. I am not so familiar with using
`git submodule`.

```sh
```bash
hub submodule add <submodule-path>

# also the same as
Expand All @@ -126,7 +126,7 @@ and it offers GitHub features in commands we can use easily add to our workflow.
Show shell instructions for wrapping git. Understanding that hub wrapping `git`
gives us an extended functionality of `git` as it relates to GitHub.

```sh
```bash
hub alias
hub alias -s
# this will show the output suitable for eval i.e output you can add to bashrc or zshrc files
Expand All @@ -138,7 +138,7 @@ Low-level GitHub API request interface. This is so powerful that you have the
power to extend any functionality that the GitHub api provides easily by passing
the route excluding the `baseUrl=https://api.github.com`.

```sh
```bash
# List collaborators:
hub api repos/:user/:repo/collaborators | jq ".[].login"
# Add collaborator:
Expand All @@ -165,7 +165,7 @@ with `issues` or `pr`. Check the examples below for more clarification when
dealing with issues and pr. Another thing is the option to pass specific COMMIT
SHA to open to a GitHub commit directly.

```sh
```bash
hub browse
# open https://github.com/YOUR_USER/CURRENT_REPO

Expand Down Expand Up @@ -194,7 +194,7 @@ hub browse resque network
- `hub ci-status` - This will help to display status of GitHub checks for a
commit if it run any form of ci like GitHub actions and the likes.

```sh
```bash
hub ci-status [commit]
# (prints CI state of commit and exits with appropriate code)
# One of: success (0), error (1), failure (1), pending (2), no status (3)
Expand All @@ -205,7 +205,7 @@ hub ci-status [commit]
Open a GitHub compare page in a web browser. Compare a branch with the default
branch or compare tags and releases

```sh
```bash
# compares refactor with the default branch
hub compare refactor
# open https://github.com/CURRENT_REPO/compare/refactor
Expand All @@ -228,7 +228,7 @@ Create a new repository on GitHub and add a git remote for it. It is as simple
as that. If you have even tried to setup your code on GitHub then you will
appreciate this one line command to create a GitHub repository.

```sh
```bash
hub create <reponame>
# if reponame is not added then the name of the folder is used
[ repo created on GitHub ]
Expand All @@ -250,7 +250,7 @@ git remote add origin [email protected]:sinatra/recipes.git

Delete a repository on GitHub.

```sh
```bash
hub delete reponame

hub delete ORG/reponame -y
Expand All @@ -261,7 +261,7 @@ hub delete ORG/reponame -y

Fork the current repository on GitHub and add a git remote for it.

```sh
```bash
hub fork
# user manually doing this will have to run the following steps below
[ repo forked on GitHub ]
Expand All @@ -279,7 +279,7 @@ You can access all the powers of GitHub gists. Do you know you can use `npx` to
run gists? even when npm packages. I will write about how to do that and share
the url as well.

```sh
```bash
hub gist create test.graphql
# this command looks for a test.graphql file and put it into a git with a public shareable link
```
Expand All @@ -290,7 +290,7 @@ Create a GitHub Pull Request whether from standard input of file or default
editor you can created a pull request without going to GitHub.Examples of
commands to create Pull Requests.

```sh
```bash
# while on a topic branch called "feature":
hub pull-request
[ opens text editor to edit title & body for the request ]
Expand All @@ -303,7 +303,7 @@ $ hub pull-request -m "pull request title " -b base-branch -h feature-branch
- `hub pr` - Manage GitHub Pull Requests for the current repository. List ,
checkout and show pr using this command.

```sh
```bash
# will list all the pr on the repository
hub pr list

Expand All @@ -324,7 +324,7 @@ almost the same principles of `pr` and `pull-request` i.e the showing with issue
number, creating with -m "test" or standard input or text editor, listing all
the available issues.

```sh
```bash
hub issue list

hub issue show #issue-number
Expand All @@ -349,7 +349,7 @@ follows the hub standard of creating, listing, edit and delete.

Fetch git objects from upstream and update local branches.

```sh
```bash
hub sync
```

Expand Down
14 changes: 7 additions & 7 deletions content/blog/git-with-hub-like-github/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ following commands to install `hub`. For more step on how to install `hub` on
other operating system. check &lt;https://github.com/github/hub&gt;. One benefit
of `hub` is its usage in your GitHub actions.

```sh
```bash
brew install Hub

# run a check to see if hub is installed and its version
Expand All @@ -79,7 +79,7 @@ hub version
Examples of task that you can do on `GitHub` that `hub` was created to make
smooth. Its `GitHub` on the command line.

```sh
```bash
# cloning of repository
hub clone <url> or <name of the repo> - it sets the authenticated user github name as the default

Expand Down Expand Up @@ -133,7 +133,7 @@ with you.
one `hub apply` will explain more about patches). You can try it with a commit
url from GitHub.

```sh
```bash
hub am --ignore-whitespace https://github.com/davidbalbert/hub/commit/fdb9921
# downloads patch via API
git am --ignore-whitespace /tmp/fdb9921.patch
Expand All @@ -146,7 +146,7 @@ git am --ignore-whitespace /tmp/fdb9921.patch
create a patch from the changes. A patch contains the file changes, commits
and all necessary information that can be added to the git directory.

```sh
```bash
git diff > mypatch.patch

git diff --cached > mypatch.patch
Expand All @@ -166,7 +166,7 @@ context of tools like GitHub.
a new branch locally from a GitHub pull request.It in essence pull the changes
from a pull request to an existing or new branch.

```sh
```bash
hub checkout https://github.com/username/repo/pull/73
OR
# alternative method
Expand All @@ -185,7 +185,7 @@ hub checkout https://github.com/username/repo/pull/73 custom-branch-name
is to cherry-pick a commit from GitHub and apply the changes to your code
locally. it offers you lot of powers to experiment.

```sh
```bash
hub cherry-pick https://github.com/username/repo/commit/SHA
OR
git remote add -f remoteName git://github.com/username/REPO.git
Expand All @@ -204,7 +204,7 @@ git cherry-pick SHA

- `hub clone` - Clone a repository from GitHub. Consider the following commands.

```sh
```bash
hub clone schacon/ticgit
OR
git clone git://github.com/schacon/ticgit.git
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ To create a project with vitejs, all you need to do is to copy and paste this in
your command line or terminal utility. The name of the folder your app will be
created in is `react-typescript-playground`.

```sh{3,6,10}
```bash{3,6,10}
# react-typescript-playground will be the name of the project
# I prefer yarn but if you like npm check how to use npm in place of yarn here
# https://classic.yarnpkg.com/en/docs/migrating-from-npm/#toc-cli-commands-comparison
Expand All @@ -71,7 +71,7 @@ a project setup for you to play with. Change directory into the new create app
folder and run the yarn command to install the project dependencies. For vitejs
the dependencies is minimal.

```sh{2-4}
```bash{2-4}
# cd into the folder/project
cd react-typescript-playground
# run npm install or yarn to install the dependencies
Expand Down Expand Up @@ -105,7 +105,7 @@ understands. We need to install
jest to understand our css module file - `app.css` file and we can mock out the
files (svg and others) we use in our great counter app.

```sh
```bash
yarn add -D [email protected] @types/jest @[email protected] @testing-library/react @testing-library/js-dom
```

Expand Down Expand Up @@ -250,7 +250,7 @@ start migrating to setup with babel-jest.

Here is the code to commit your changes and create a new branch.

```sh
```bash
git add .
git commit -m "writing test using `ts-jest`"
git checkout -b "babel-jest"
Expand All @@ -267,7 +267,7 @@ frontend app you can plan to write one. it increases your confidence.

- install the necessary babel packages

```sh{1}
```bash{1}
yarn add -D @babel/core @babel/preset-env @babel/preset-react @babel/preset-typescript babel-jest
# add the @babel/plugin-transform-runtime to avoid the runtime error.
yarn add -D @babel/plugin-transform-runtime
Expand Down
Loading

0 comments on commit 03cafc4

Please sign in to comment.