Reformat all code to use shell instead of sh

This commit is contained in:
Chalarangelo
2021-04-13 21:10:59 +03:00
parent ff970c154e
commit fd6fe2056d
83 changed files with 166 additions and 166 deletions

View File

@ -9,11 +9,11 @@ Explain briefly what the snippet does.
- Use bullet points for your snippet's explanation. - Use bullet points for your snippet's explanation.
- Try to explain everything briefly but clearly. - Try to explain everything briefly but clearly.
```sh ```shell
git command <variable> [--option] git command <variable> [--option]
``` ```
```sh ```shell
git command some-branch --quiet git command some-branch --quiet
# Output of running command on `some-branch` # Output of running command on `some-branch`
``` ```

View File

@ -7,11 +7,11 @@ Adds a new submodule to the repository.
- Use `git submodule add <upstream-path> <local-path>` to add a new submodule from `<upstream-path>` to `<local-path>`. - Use `git submodule add <upstream-path> <local-path>` to add a new submodule from `<upstream-path>` to `<local-path>`.
```sh ```shell
git submodule add <upstream-path> <local-path> git submodule add <upstream-path> <local-path>
``` ```
```sh ```shell
git submodule add https://github.com/30-seconds/30-seconds-of-code ./30code git submodule add https://github.com/30-seconds/30-seconds-of-code ./30code
# Creates the directory `30code` containing the submodule from # Creates the directory `30code` containing the submodule from
# "https://github.com/30-seconds/30-seconds-of-code" # "https://github.com/30-seconds/30-seconds-of-code"

View File

@ -7,10 +7,10 @@ Applies the latest stash.
- Use `git stash apply` to apply the latest stash. - Use `git stash apply` to apply the latest stash.
```sh ```shell
git stash apply <stash> git stash apply <stash>
``` ```
```sh ```shell
git stash apply # Applies the latest stash git stash apply # Applies the latest stash
``` ```

View File

@ -7,10 +7,10 @@ Applies a specific stash.
- Use `git stash apply <stash>` to apply the given `<stash>`. - Use `git stash apply <stash>` to apply the given `<stash>`.
```sh ```shell
git stash apply <stash> git stash apply <stash>
``` ```
```sh ```shell
git stash apply stash@{1} # Applies `stash@{1}` git stash apply stash@{1} # Applies `stash@{1}`
``` ```

View File

@ -7,11 +7,11 @@ Configures git to autocorrect mistyped commands.
- Use `git config --global help.autocorrect 1` to enable git's autocorrect. - Use `git config --global help.autocorrect 1` to enable git's autocorrect.
```sh ```shell
git config --global help.autocorrect 1 git config --global help.autocorrect 1
``` ```
```sh ```shell
git config --global help.autocorrect 1 git config --global help.autocorrect 1
git sttaus # Runs `git status` instead git sttaus # Runs `git status` instead
``` ```

View File

@ -11,7 +11,7 @@ Uses a binary search algorithm and a given script to find which commit in histor
- Use `git bisect run <command>` to run the given `<command>` on each subsequent commit to find which commit introduce the bug. - Use `git bisect run <command>` to run the given `<command>` on each subsequent commit to find which commit introduce the bug.
- Use `git bisect reset` to reset to the original branch. You can optionally specify a `<commit>` to reset to. - Use `git bisect reset` to reset to the original branch. You can optionally specify a `<commit>` to reset to.
```sh ```shell
git bisect start git bisect start
git bisect good <commit> git bisect good <commit>
git bisect bad <commit> git bisect bad <commit>
@ -19,7 +19,7 @@ git bisect run <command>
git bisect reset [<commit>] git bisect reset [<commit>]
``` ```
```sh ```shell
git bisect start git bisect start
git bisect good 3050fc0de git bisect good 3050fc0de
git bisect bad c191f90c7 git bisect bad c191f90c7

View File

@ -7,11 +7,11 @@ Prints all the branches containing a specific commit.
- Use `git branch --contains <commit>` to see a list of all branches containing `<commit>`. - Use `git branch --contains <commit>` to see a list of all branches containing `<commit>`.
```sh ```shell
git branch --contains <commit> git branch --contains <commit>
``` ```
```sh ```shell
git branch --contains 3050fc0d3 git branch --contains 3050fc0d3
# patch-1 # patch-1
# patch-2 # patch-2

View File

@ -7,11 +7,11 @@ Prints all the branches not containing a specific commit.
- Use `git branch --no-contains <commit>` to see a list of all branches not containing `<commit>`. - Use `git branch --no-contains <commit>` to see a list of all branches not containing `<commit>`.
```sh ```shell
git branch --no-contains <commit> git branch --no-contains <commit>
``` ```
```sh ```shell
git branch --no-contains 3050fc0d3 git branch --no-contains 3050fc0d3
# patch-3 # patch-3
# patch-4 # patch-4

View File

@ -7,11 +7,11 @@ Changes the URL of the remote repository.
- Use `git remote set-url origin <url>` to change the URL of the remote repository to `<url>`. - Use `git remote set-url origin <url>` to change the URL of the remote repository to `<url>`.
```sh ```shell
git remote set-url origin <url> git remote set-url origin <url>
``` ```
```sh ```shell
git remote set-url origin https://github.com/30-seconds/30-seconds-of-code git remote set-url origin https://github.com/30-seconds/30-seconds-of-code
# The remote URL is now "https://github.com/30-seconds/30-seconds-of-code" # The remote URL is now "https://github.com/30-seconds/30-seconds-of-code"
``` ```

View File

@ -7,11 +7,11 @@ Clones missing submodules and checks out commits.
- Use `git submodule update --init --recursive` to clone missing submodules and checkout commits. - Use `git submodule update --init --recursive` to clone missing submodules and checkout commits.
```sh ```shell
git submodule update --init --recursive git submodule update --init --recursive
``` ```
```sh ```shell
git submodule update --init --recursive git submodule update --init --recursive
# Clones missing submodules and checks out commits # Clones missing submodules and checks out commits
``` ```

View File

@ -8,11 +8,11 @@ Clones an existing repository, creating a local copy of it.
- Use `git clone <url>` to clone an existing repository from `<url>` to a local directory. The directory's name will be based on the name of the cloned repository. - Use `git clone <url>` to clone an existing repository from `<url>` to a local directory. The directory's name will be based on the name of the cloned repository.
- Alternatively, use `git clone <url> [<directory>]` to clone the repository into the specified local `<directory>`. - Alternatively, use `git clone <url> [<directory>]` to clone the repository into the specified local `<directory>`.
```sh ```shell
git clone <url> [<directory>] git clone <url> [<directory>]
``` ```
```sh ```shell
git clone https://github.com/30-seconds/30-seconds-of-code.git git clone https://github.com/30-seconds/30-seconds-of-code.git
# Clones the repository in a new directory named '30-seconds-of-code' # Clones the repository in a new directory named '30-seconds-of-code'
cd 30-seconds-of-code cd 30-seconds-of-code

View File

@ -8,11 +8,11 @@ Creates a new commit by the specified author.
- Use `git commit -m <message>` to create a new commit with the specified `<message>`. - Use `git commit -m <message>` to create a new commit with the specified `<message>`.
- Use the `--author` option to change the `<name>` and `<email>` of the commit's author. - Use the `--author` option to change the `<name>` and `<email>` of the commit's author.
```sh ```shell
git commit -m <message> --author="<name> <email>" git commit -m <message> --author="<name> <email>"
``` ```
```sh ```shell
# Make some changes to files # Make some changes to files
git add . git add .
git commit -m "Fix the network bug" --author="Duck Quackers <cool.duck@qua.ck>" git commit -m "Fix the network bug" --author="Duck Quackers <cool.duck@qua.ck>"

View File

@ -7,11 +7,11 @@ Sets up a commit message template for the current repository.
- Use `git config commit.template <file>` to specify `<file>` as the commit message template for the current repository. - Use `git config commit.template <file>` to specify `<file>` as the commit message template for the current repository.
```sh ```shell
git config commit.template <file> git config commit.template <file>
``` ```
```sh ```shell
git config commit.template "commit-template" git config commit.template "commit-template"
# Sets "commit-template" as the commit message template # Sets "commit-template" as the commit message template
``` ```

View File

@ -7,11 +7,11 @@ Creates a new commit skipping the pre-commit and commit-msg hooks.
- Use `git commit --no-verify -m <message>` to commit staged changes without running git hooks. - Use `git commit --no-verify -m <message>` to commit staged changes without running git hooks.
```sh ```shell
git commit --no-verify -m <message> git commit --no-verify -m <message>
``` ```
```sh ```shell
# Make some changes to files, ones that your precommit hook might not allow # Make some changes to files, ones that your precommit hook might not allow
git add . git add .
git commit --no-verify -m "Unsafe commit" git commit --no-verify -m "Unsafe commit"

View File

@ -9,12 +9,12 @@ Configures user information for git.
- Use `git config user.name <name>` to set the user's name for the current repository. - Use `git config user.name <name>` to set the user's name for the current repository.
- You can use the `--global` flag to configure global user information. - You can use the `--global` flag to configure global user information.
```sh ```shell
git config [--global] user.email <email> git config [--global] user.email <email>
git config [--global] user.name <name> git config [--global] user.name <name>
``` ```
```sh ```shell
git config user.email "cool.duck@qua.ck" git config user.email "cool.duck@qua.ck"
git config user.name "Duck Quackers" git config user.name "Duck Quackers"
# Configures user for current repository # Configures user for current repository

View File

@ -7,11 +7,11 @@ Copies a file from another branch to the current branch.
- Use `git checkout <branch> <file>` to copy the specified `<file>` from the specified `<branch>`. - Use `git checkout <branch> <file>` to copy the specified `<file>` from the specified `<branch>`.
```sh ```shell
git checkout <branch> <file> git checkout <branch> <file>
``` ```
```sh ```shell
git checkout patch-2 git checkout patch-2
git checkout patch-1 "30seconds.txt" git checkout patch-1 "30seconds.txt"
# `patch-2` branch now contains the 30seconds.txt file from `patch-1` # `patch-2` branch now contains the 30seconds.txt file from `patch-1`

View File

@ -9,11 +9,11 @@ Creates and switches to a new branch, optionally setting up a remote tracking br
- You can optionally add `-t <remote>/<branch>` to set up a remote tracking branch for the newly created branch. - You can optionally add `-t <remote>/<branch>` to set up a remote tracking branch for the newly created branch.
- Note: You can alternatively use `git branch <branch> [-t <remote>/<branch>]` and then `git checkout <branch>` separately. - Note: You can alternatively use `git branch <branch> [-t <remote>/<branch>]` and then `git checkout <branch>` separately.
```sh ```shell
git checkout -b <branch> [-t <remote>/<branch>] git checkout -b <branch> [-t <remote>/<branch>]
``` ```
```sh ```shell
git checkout -b patch-1 git checkout -b patch-1
# Local branch, without a remote tracking branch # Local branch, without a remote tracking branch

View File

@ -7,11 +7,11 @@ Creates a new commit containing the staged changes.
- Use `git commit -m <message>` to create a new commit with the specified `<message>`. - Use `git commit -m <message>` to create a new commit with the specified `<message>`.
```sh ```shell
git commit -m <message> git commit -m <message>
``` ```
```sh ```shell
# Make some changes to files # Make some changes to files
git add . git add .
git commit -m "Fix the network bug" git commit -m "Fix the network bug"

View File

@ -7,11 +7,11 @@ Creates an empty commit.
- Use `git commit --allow-empty -m <message>` to create an empty commit with the provided `<message>`. - Use `git commit --allow-empty -m <message>` to create an empty commit with the provided `<message>`.
```sh ```shell
git commit --allow-empty -m <message> git commit --allow-empty -m <message>
``` ```
```sh ```shell
git commit --allow-empty -m "Empty commit" git commit --allow-empty -m "Empty commit"
# Creates an empty commit with the message "Empty commit" # Creates an empty commit with the message "Empty commit"
``` ```

View File

@ -8,11 +8,11 @@ Creates a fixup commit that can be autosquashed in the next rebase.
- Use `git commit --fixup <commit>` to create a fixup commit for the specified `<commit>`. - Use `git commit --fixup <commit>` to create a fixup commit for the specified `<commit>`.
- After running `git rebase --autosquash`, fixup commits will be automatically squashed into the commits they reference. - After running `git rebase --autosquash`, fixup commits will be automatically squashed into the commits they reference.
```sh ```shell
git commit --fixup <commit> git commit --fixup <commit>
``` ```
```sh ```shell
git add . git add .
git commit --fixup 3050fc0de git commit --fixup 3050fc0de
# Created a fixup commit for `3050fc0de` # Created a fixup commit for `3050fc0de`

View File

@ -10,11 +10,11 @@ Initializes a new git repository, setting up all the configuration files needed
- Note: Running `git init` in an existing repository is safe. - Note: Running `git init` in an existing repository is safe.
- Note: You only need to run `git init` once per repository. - Note: You only need to run `git init` once per repository.
```sh ```shell
git init [<directory>] git init [<directory>]
``` ```
```sh ```shell
cd ~/my_project cd ~/my_project
git init # Initializes a repo in ~/my_project git init # Initializes a repo in ~/my_project

View File

@ -7,11 +7,11 @@ Prints the current branch name.
- Use `git rev-parse --abbrev-ref HEAD` to print the name of the current branch. - Use `git rev-parse --abbrev-ref HEAD` to print the name of the current branch.
```sh ```shell
git rev-parse --abbrev-ref HEAD git rev-parse --abbrev-ref HEAD
``` ```
```sh ```shell
git checkout patch-1 git checkout patch-1
git rev-parse --abbrev-ref HEAD # Prints `patch-1` git rev-parse --abbrev-ref HEAD # Prints `patch-1`
``` ```

View File

@ -7,11 +7,11 @@ Deletes a local branch.
- Use `git branch -d <branch>` to delete the specified local `<branch>`. - Use `git branch -d <branch>` to delete the specified local `<branch>`.
```sh ```shell
git branch -d <branch> git branch -d <branch>
``` ```
```sh ```shell
git checkout master git checkout master
git branch -d patch-1 # Deletes the `patch-1` local branch git branch -d patch-1 # Deletes the `patch-1` local branch
``` ```

View File

@ -8,11 +8,11 @@ Deletes all detached branches.
- Use `git fetch --all --prune` to garbage collect any detached branches. - Use `git fetch --all --prune` to garbage collect any detached branches.
- This is especially useful if the remote repository is set to automatically delete merged branches. - This is especially useful if the remote repository is set to automatically delete merged branches.
```sh ```shell
git fetch --all --prune git fetch --all --prune
``` ```
```sh ```shell
git checkout master git checkout master
git branch git branch
# master # master

View File

@ -9,11 +9,11 @@ Deletes all local merged branches.
- Use the pipe operator (`|`) to pipe the output and `grep -v "(^\*|<branch>)"` to exclude the current and the target `<branch>`. - Use the pipe operator (`|`) to pipe the output and `grep -v "(^\*|<branch>)"` to exclude the current and the target `<branch>`.
- Use the pipe operator (`|`) to pipe the output and `xargs git branch -d` to delete all of the found branches. - Use the pipe operator (`|`) to pipe the output and `xargs git branch -d` to delete all of the found branches.
```sh ```shell
git branch --merged <branch> | grep -v "(^\*|<branch>)" | xargs git branch -d git branch --merged <branch> | grep -v "(^\*|<branch>)" | xargs git branch -d
``` ```
```sh ```shell
git checkout master git checkout master
git branch git branch
# master # master

View File

@ -7,11 +7,11 @@ Deletes a remote branch.
- Use `git push -d <remote> <branch>` to delete the specified remote `<branch>` on the given `<remote>`. - Use `git push -d <remote> <branch>` to delete the specified remote `<branch>` on the given `<remote>`.
```sh ```shell
git push -d <remote> <branch> git push -d <remote> <branch>
``` ```
```sh ```shell
git checkout master git checkout master
git push -d origin patch-1 # Deletes the `patch-1` remote branch git push -d origin patch-1 # Deletes the `patch-1` remote branch
``` ```

View File

@ -7,10 +7,10 @@ Deletes a specific stash.
- Use `git stash drop <stash>` to delete the given `<stash>`. - Use `git stash drop <stash>` to delete the given `<stash>`.
```sh ```shell
git stash drop <stash> git stash drop <stash>
``` ```
```sh ```shell
git stash drop stash@{1} # Deletes `stash@{1}` git stash drop stash@{1} # Deletes `stash@{1}`
``` ```

View File

@ -7,11 +7,11 @@ Deletes all stashes.
- Use `git stash clear` to delete all stashes. - Use `git stash clear` to delete all stashes.
```sh ```shell
git stash clear git stash clear
``` ```
```sh ```shell
git stash clear git stash clear
# Deletes all stashes # Deletes all stashes
``` ```

View File

@ -9,13 +9,13 @@ Deletes a submodule from the repository.
- Use `rm -rf .git/modules/<submodule>` to remove the directory of the submodule. - Use `rm -rf .git/modules/<submodule>` to remove the directory of the submodule.
- Use `git rm -f <submodule>` to remove the working tree of the submodule. - Use `git rm -f <submodule>` to remove the working tree of the submodule.
```sh ```shell
git submodule deinit -f -- <submodule> git submodule deinit -f -- <submodule>
rm -rf .git/modules/<submodule> rm -rf .git/modules/<submodule>
git rm -f <submodule> git rm -f <submodule>
``` ```
```sh ```shell
git submodule deinit -f -- 30code git submodule deinit -f -- 30code
rm -rf .git/modules/30code rm -rf .git/modules/30code
git rm -f 30code git rm -f 30code

View File

@ -7,11 +7,11 @@ Displays the difference between two branches.
- Use `git diff <branch>..<other-branch> ` to view the difference between `<branch>` and `<other-branch>`. - Use `git diff <branch>..<other-branch> ` to view the difference between `<branch>` and `<other-branch>`.
```sh ```shell
git diff <branch>..<other-branch> git diff <branch>..<other-branch>
``` ```
```sh ```shell
git diff patch-1..patch-2 git diff patch-1..patch-2
# Displays the difference between branches `patch-1` and `patch-2` # Displays the difference between branches `patch-1` and `patch-2`
``` ```

View File

@ -7,11 +7,11 @@ Discards all uncommitted changes to the current branch.
- Use `git reset --hard HEAD` to reset the local directory to match the latest commit and discard all unstaged changes. - Use `git reset --hard HEAD` to reset the local directory to match the latest commit and discard all unstaged changes.
```sh ```shell
git reset --hard HEAD git reset --hard HEAD
``` ```
```sh ```shell
git reset --hard HEAD git reset --hard HEAD
# Discards all unstaged changes # Discards all unstaged changes
``` ```

View File

@ -7,11 +7,11 @@ Discards all untracked changes to the current branch.
- Use `git clean -f -d` to discard all untracked changes to the current branch. - Use `git clean -f -d` to discard all untracked changes to the current branch.
```sh ```shell
git clean -f -d git clean -f -d
``` ```
```sh ```shell
git clean -f -d git clean -f -d
# Discards all untracked changes # Discards all untracked changes
``` ```

View File

@ -7,11 +7,11 @@ Opens the git configuration file in the git text editor.
- Use `git config --global -e` to open the git configuration file in the git text editor. - Use `git config --global -e` to open the git configuration file in the git text editor.
```sh ```shell
git config --global -e git config --global -e
``` ```
```sh ```shell
git config --global -e git config --global -e
# Opens the git configuration file in the default git text editor # Opens the git configuration file in the default git text editor
``` ```

View File

@ -7,10 +7,10 @@ Fetches the latest changes from the remote.
- Use `git fetch` to get the latest changes from the remote, without applying them. - Use `git fetch` to get the latest changes from the remote, without applying them.
```sh ```shell
git fetch git fetch
``` ```
```sh ```shell
git fetch # Fetches the latest updates from the remote git fetch # Fetches the latest updates from the remote
``` ```

View File

@ -8,11 +8,11 @@ Prints a list of lost files and commits.
- Use `git fsck --lost-found` to print a list of all dangling objects. - Use `git fsck --lost-found` to print a list of all dangling objects.
- All appropriate files will be extracted into the `.git/lost-found` directory. - All appropriate files will be extracted into the `.git/lost-found` directory.
```sh ```shell
git fsck --lost-found git fsck --lost-found
``` ```
```sh ```shell
git fsck --lost-found git fsck --lost-found
# dangling commit 3050fc0de # dangling commit 3050fc0de
# dangling blob 807e3fa41 # dangling blob 807e3fa41

View File

@ -8,11 +8,11 @@ Forces an update of the remote branch adter rewriting the history locally.
- Use `git push -f` to force update the remote branch, overwriting it using the local branch's changes. - Use `git push -f` to force update the remote branch, overwriting it using the local branch's changes.
- This operation is necessary anytime your local and remote repository diverge. - This operation is necessary anytime your local and remote repository diverge.
```sh ```shell
git push -f git push -f
``` ```
```sh ```shell
git checkout patch-1 git checkout patch-1
git pull git pull
git rebase master git rebase master

View File

@ -10,11 +10,11 @@ Performs an interactive rebase.
- You can optionally use the `--autosquash` option to automatically squash fixup commits. - You can optionally use the `--autosquash` option to automatically squash fixup commits.
- If you have merge conflicts or stop to make changes, you can continue the rebase when ready using `git rebase --continue` or abort it using `git rebase --abort`. - If you have merge conflicts or stop to make changes, you can continue the rebase when ready using `git rebase --continue` or abort it using `git rebase --abort`.
```sh ```shell
git rebase -i [--autosquash] <commit> git rebase -i [--autosquash] <commit>
``` ```
```sh ```shell
git rebase -i 3050fc0de git rebase -i 3050fc0de
# Performs an interactive rebase starting from `3050fc0de` # Performs an interactive rebase starting from `3050fc0de`

View File

@ -8,10 +8,10 @@ Configures the line endings for a repository.
- Use `git config core.eol [lf | crlf]` to configure the line endings. - Use `git config core.eol [lf | crlf]` to configure the line endings.
- `lf` is the UNIX line ending (`\n`), whereas `crlf` is the DOS line ending (`\r\n`). - `lf` is the UNIX line ending (`\n`), whereas `crlf` is the DOS line ending (`\r\n`).
```sh ```shell
git config core.eol [lf | crlf] git config core.eol [lf | crlf]
``` ```
```sh ```shell
git config core.eol lf # Configured to use UNIX line endings git config core.eol lf # Configured to use UNIX line endings
``` ```

View File

@ -9,11 +9,11 @@ Prints a list of all git aliases.
- Use the pipe operator (`|`) to pipe the output and `grep alias` to only keep aliases. - Use the pipe operator (`|`) to pipe the output and `grep alias` to only keep aliases.
- Use the pipe operator (`|`) to pipe the output and `sed 's/^alias\.//g'` to remove the `alias.` part from each alias. - Use the pipe operator (`|`) to pipe the output and `sed 's/^alias\.//g'` to remove the `alias.` part from each alias.
```sh ```shell
git config -l | grep alias | sed 's/^alias\.//g' git config -l | grep alias | sed 's/^alias\.//g'
``` ```
```sh ```shell
git config -l | grep alias | sed 's/^alias\.//g' git config -l | grep alias | sed 's/^alias\.//g'
# st=status # st=status
# co=checkout # co=checkout

View File

@ -7,11 +7,11 @@ Displays a list of all stashes.
- Use `git stash list` to view a list of all stashes. - Use `git stash list` to view a list of all stashes.
```sh ```shell
git stash list git stash list
``` ```
```sh ```shell
git stash list git stash list
# stash@{0}: WIP on patch-1: ee52eda Fix network bug # stash@{0}: WIP on patch-1: ee52eda Fix network bug
``` ```

View File

@ -11,7 +11,7 @@ Uses a binary search algorithm to manually find which commit in history introduc
- Use `git bisect (bad | good)` marking each subsequent commit as "good" or "bad" depending if it has the bug or not. - Use `git bisect (bad | good)` marking each subsequent commit as "good" or "bad" depending if it has the bug or not.
- Use `git bisect reset` to reset to the original branch. You can optionally specify a `<commit>` to reset to. - Use `git bisect reset` to reset to the original branch. You can optionally specify a `<commit>` to reset to.
```sh ```shell
git bisect start git bisect start
git bisect good <commit> git bisect good <commit>
git bisect bad <commit> git bisect bad <commit>
@ -19,7 +19,7 @@ git bisect (bad | good)
git bisect reset [<commit>] git bisect reset [<commit>]
``` ```
```sh ```shell
git bisect start git bisect start
git bisect good 3050fc0de git bisect good 3050fc0de
git bisect bad c191f90c7 git bisect bad c191f90c7

View File

@ -8,12 +8,12 @@ Merges a branch into the current branch, creating a merge commit.
- Use `git checkout <target-branch>` to switch to the branch into which you want to merge. - Use `git checkout <target-branch>` to switch to the branch into which you want to merge.
- Use `git merge --no-ff -m <message> <source-branch>` to merge a branch into the current branch, creating a merge commit with the specified `<message>`. - Use `git merge --no-ff -m <message> <source-branch>` to merge a branch into the current branch, creating a merge commit with the specified `<message>`.
```sh ```shell
git checkout <target-branch> git checkout <target-branch>
git merge --no-ff -m <message> <source-branch> git merge --no-ff -m <message> <source-branch>
``` ```
```sh ```shell
git checkout master git checkout master
git merge --no-ff -m "Merge patch-1" patch-1 git merge --no-ff -m "Merge patch-1" patch-1
# Merges the `patch-1` branch into `master` and creates a commit # Merges the `patch-1` branch into `master` and creates a commit

View File

@ -8,12 +8,12 @@ Merges a branch into the current branch.
- Use `git checkout <target-branch>` to switch to the branch into which you want to merge. - Use `git checkout <target-branch>` to switch to the branch into which you want to merge.
- Use `git merge <source-branch>` to merge a branch into the current branch. - Use `git merge <source-branch>` to merge a branch into the current branch.
```sh ```shell
git checkout <target-branch> git checkout <target-branch>
git merge <source-branch> git merge <source-branch>
``` ```
```sh ```shell
git checkout master git checkout master
git merge patch-1 # Merges the `patch-1` branch into `master` git merge patch-1 # Merges the `patch-1` branch into `master`
``` ```

View File

@ -10,13 +10,13 @@ Moves local commits from the `master` branch to a new branch.
- Use `git checkout <branch>` to switch to the new branch. - Use `git checkout <branch>` to switch to the new branch.
- Only works if the changes have only been committed locally and not pushed to the remote. - Only works if the changes have only been committed locally and not pushed to the remote.
```sh ```shell
git branch <branch> git branch <branch>
git reset HEAD~<n> --hard git reset HEAD~<n> --hard
git checkout <branch> git checkout <branch>
``` ```
```sh ```shell
git checkout master git checkout master
git add . git add .
git commit -m "Fix network bug" git commit -m "Fix network bug"

View File

@ -7,10 +7,10 @@ Optimizes the local repository.
- Use `git gc --prune=now --aggressive` to garbage collect loose objects. - Use `git gc --prune=now --aggressive` to garbage collect loose objects.
```sh ```shell
git gc --prune=now --aggressive git gc --prune=now --aggressive
``` ```
```sh ```shell
git gc --prune=now --aggressive # Optimizes the local repository git gc --prune=now --aggressive # Optimizes the local repository
``` ```

View File

@ -9,11 +9,11 @@ Applies the changes introduced by one or more commits.
- Use `git cherry-pick <commit-1> <commit-2>...` to pick changes from all space-separated commits. - Use `git cherry-pick <commit-1> <commit-2>...` to pick changes from all space-separated commits.
- Use `git cherry-pick <first-commit>..<last-commit>` to pick changes from a range of commits. - Use `git cherry-pick <first-commit>..<last-commit>` to pick changes from a range of commits.
```sh ```shell
git cherry-pick (<commit>... | <first-commit>..<last-commit>) git cherry-pick (<commit>... | <first-commit>..<last-commit>)
``` ```
```sh ```shell
git cherry-pick 3050fc0de # Picks changes from the commit `3050fc0de` git cherry-pick 3050fc0de # Picks changes from the commit `3050fc0de`
git cherry-pick 3050fc0de c191f90c7 git cherry-pick 3050fc0de c191f90c7

View File

@ -7,11 +7,11 @@ Pulls all submodules from their respective remotes.
- Use `git submodule update --recursive --remote` to pull all submodules from their respective remotes. - Use `git submodule update --recursive --remote` to pull all submodules from their respective remotes.
```sh ```shell
git submodule update --recursive --remote git submodule update --recursive --remote
``` ```
```sh ```shell
git submodule update --recursive --remote git submodule update --recursive --remote
# Pulls all submodules from their respective remotes # Pulls all submodules from their respective remotes
``` ```

View File

@ -7,11 +7,11 @@ Pulls the latest changes from the remote tracking branch.
- Use `git pull` to fetch and apply the latest changes from the remote. - Use `git pull` to fetch and apply the latest changes from the remote.
```sh ```shell
git pull git pull
``` ```
```sh ```shell
# Assuming the remote `patch-1` branch is ahead of the local one # Assuming the remote `patch-1` branch is ahead of the local one
git checkout patch-1 git checkout patch-1
git pull # The local `patch-1` branch is now up to date with the remote branch git pull # The local `patch-1` branch is now up to date with the remote branch

View File

@ -10,14 +10,14 @@ Completely purges a file from history.
- You can optionally use `git push <remote> --force -all` to force push the changes to the remote repository. - You can optionally use `git push <remote> --force -all` to force push the changes to the remote repository.
- ⚠️ **WARNING**: This is a destructive action that rewrites the history of the entire repository. Make sure you know what you are doing. - ⚠️ **WARNING**: This is a destructive action that rewrites the history of the entire repository. Make sure you know what you are doing.
```sh ```shell
git filter-branch --force --index-filter \ git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch <path>" \ "git rm --cached --ignore-unmatch <path>" \
--prune-empty --tag-name-filter cat -- --all --prune-empty --tag-name-filter cat -- --all
git push <remote> --force --all git push <remote> --force --all
``` ```
```sh ```shell
git filter-branch --force --index-filter \ git filter-branch --force --index-filter \
"git rm --cached --ignore-unmatch config/apiKeys.json" \ "git rm --cached --ignore-unmatch config/apiKeys.json" \
--prune-empty --tag-name-filter cat -- --all --prune-empty --tag-name-filter cat -- --all

View File

@ -7,11 +7,11 @@ Pushes the current branch's changes to the remote.
- Use `git push` to push the latest changes from the local branch to the remote. - Use `git push` to push the latest changes from the local branch to the remote.
```sh ```shell
git fetch git fetch
``` ```
```sh ```shell
# Assuming the local `patch-1` branch is ahead of the remote one # Assuming the local `patch-1` branch is ahead of the remote one
git checkout patch-1 git checkout patch-1
git push # The remote `patch-1` branch is now up to date with the local branch git push # The remote `patch-1` branch is now up to date with the local branch

View File

@ -8,12 +8,12 @@ Rebases the current branch onto another branch.
- Use `git checkout <branch>` to switch to the `<branch>` to be rebased. - Use `git checkout <branch>` to switch to the `<branch>` to be rebased.
- Use `git rebase <base-branch>` to rebase the current branch onto `<base-branch>`. - Use `git rebase <base-branch>` to rebase the current branch onto `<base-branch>`.
```sh ```shell
git checkout <branch> git checkout <branch>
git rebase <base-branch> git rebase <base-branch>
``` ```
```sh ```shell
git checkout patch-1 git checkout patch-1
git rebase master git rebase master
# `patch-1` is rebased onto `master` # `patch-1` is rebased onto `master`

View File

@ -8,12 +8,12 @@ Removes a file from the last commit without changing its message.
- Use `git rm —-cached <file>` to remove the specified `<file>` from the index. - Use `git rm —-cached <file>` to remove the specified `<file>` from the index.
- Use `git commit —-amend` to update the contents of the last commit, without changing its message. - Use `git commit —-amend` to update the contents of the last commit, without changing its message.
```sh ```shell
git rm —-cached <file> git rm —-cached <file>
git commit —-amend git commit —-amend
``` ```
```sh ```shell
git rm —-cached "30-seconds.txt" git rm —-cached "30-seconds.txt"
git commit —-amend git commit —-amend
# Removes `30-seconds.txt` from the last commit # Removes `30-seconds.txt` from the last commit

View File

@ -7,11 +7,11 @@ Renames a local branch.
- Use `git branch -m <old-name> <new-name>` to rename `<old-name>` to `<new-name>`. - Use `git branch -m <old-name> <new-name>` to rename `<old-name>` to `<new-name>`.
```sh ```shell
git branch -m <old-name> <new-name> git branch -m <old-name> <new-name>
``` ```
```sh ```shell
git checkout master git checkout master
git branch -m patch-1 patch-2 git branch -m patch-1 patch-2
# Renames `patch-1` to `patch-2` # Renames `patch-1` to `patch-2`

View File

@ -10,14 +10,14 @@ Renames a branch both locally and on the remote.
- Use `git checkout <new-name>` to switch to the renamed branch. - Use `git checkout <new-name>` to switch to the renamed branch.
- Use `git push origin -u <new-name>` to set `<new-name>` as the remote branch for the renamed branch. - Use `git push origin -u <new-name>` to set `<new-name>` as the remote branch for the renamed branch.
```sh ```shell
git branch -m <old-name> <new-name> git branch -m <old-name> <new-name>
git push origin --delete <old-name> git push origin --delete <old-name>
git checkout <new-name> git checkout <new-name>
git push origin -u <new-name> git push origin -u <new-name>
``` ```
```sh ```shell
git checkout master git checkout master
git branch -m patch-1 patch-2 # Renamed the local branch to `patch-2` git branch -m patch-1 patch-2 # Renamed the local branch to `patch-2`
git push origin --delete patch-1 git push origin --delete patch-1

View File

@ -9,13 +9,13 @@ Resets the local `master` branch to match the one on the remote.
- Use `git checkout master` to switch to the `master` branch. - Use `git checkout master` to switch to the `master` branch.
- Use `git reset --hard origin/master` to reset the local `master` branch to match the one on the remote. - Use `git reset --hard origin/master` to reset the local `master` branch to match the one on the remote.
```sh ```shell
git fetch origin git fetch origin
git checkout master git checkout master
git reset --hard origin/master git reset --hard origin/master
``` ```
```sh ```shell
git fetch origin git fetch origin
git checkout master git checkout master
git reset --hard origin/master git reset --hard origin/master

View File

@ -7,11 +7,11 @@ Restores a file deleted in a specific commit.
- Use `git checkout <commit>^ -- <file>` to restore the specified `<file>` deleted in the specified `<commit>`. - Use `git checkout <commit>^ -- <file>` to restore the specified `<file>` deleted in the specified `<commit>`.
```sh ```shell
git checkout <commit>^ -- <file> git checkout <commit>^ -- <file>
``` ```
```sh ```shell
# "30seconds.txt" was deleted in the commit `3050fc0de` # "30seconds.txt" was deleted in the commit `3050fc0de`
git checkout 3050fc0de^ -- "30seconds.txt" git checkout 3050fc0de^ -- "30seconds.txt"
# Restores the 30seconds.txt file # Restores the 30seconds.txt file

View File

@ -9,11 +9,11 @@ Rewinds the current branch by a given number of commits.
- This command will uncommit and unstage changes, but leave them in the working directory. - This command will uncommit and unstage changes, but leave them in the working directory.
- You can use the `--hard` flag to uncommit, unstage and delete changes instead. - You can use the `--hard` flag to uncommit, unstage and delete changes instead.
```sh ```shell
git reset [--hard] HEAD~<n> git reset [--hard] HEAD~<n>
``` ```
```sh ```shell
git reset HEAD~5 git reset HEAD~5
# Rewinds back 5 commits but keeps changes in the working directory # Rewinds back 5 commits but keeps changes in the working directory

View File

@ -9,11 +9,11 @@ Rewinds the current branch by a given number of commits.
- This command will uncommit and unstage changes, but leave them in the working directory. - This command will uncommit and unstage changes, but leave them in the working directory.
- You can use the `--hard` flag to uncommit, unstage and delete changes instead. - You can use the `--hard` flag to uncommit, unstage and delete changes instead.
```sh ```shell
git reset [--hard] <commit> git reset [--hard] <commit>
``` ```
```sh ```shell
git reset --hard 3050fc0d3 git reset --hard 3050fc0d3
# Rewinds back to `3050fc0d3` but keeps changes in the working directory # Rewinds back to `3050fc0d3` but keeps changes in the working directory

View File

@ -9,11 +9,11 @@ Saves the current state of the working directory and index into a new stash.
- You can optionally use the `-u` option to include untracked files. - You can optionally use the `-u` option to include untracked files.
- You can optionally provide a `<message>` for the stash. - You can optionally provide a `<message>` for the stash.
```sh ```shell
git stash save [-u] [<message>] git stash save [-u] [<message>]
``` ```
```sh ```shell
git stash save git stash save
# Creates a new stash # Creates a new stash

View File

@ -7,11 +7,11 @@ Configures the text editor used by git.
- Use `git config --global core.editor <editor-command>` to call `<editor-command>` as the git text editor. - Use `git config --global core.editor <editor-command>` to call `<editor-command>` as the git text editor.
```sh ```shell
git config --global core.editor <editor-command> git config --global core.editor <editor-command>
``` ```
```sh ```shell
git config --global core.editor "code --wait" git config --global core.editor "code --wait"
# Sets VS Code as the git text editor # Sets VS Code as the git text editor
``` ```

View File

@ -8,11 +8,11 @@ Prints a list of all local branches sorted by date.
- Use `git branch --sort=-committerdate` to display a list of all local branches and sort them based on the date of their last commit. - Use `git branch --sort=-committerdate` to display a list of all local branches and sort them based on the date of their last commit.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git branch --sort=-committerdate git branch --sort=-committerdate
``` ```
```sh ```shell
git branch --sort=-committerdate git branch --sort=-committerdate
# master # master
# patch-1 # patch-1

View File

@ -8,11 +8,11 @@ Adds files to the staging area.
- Use `git add <pathspec>` to add files to the staging area. - Use `git add <pathspec>` to add files to the staging area.
- `<pathspec>` can be a filename or a fileglob. - `<pathspec>` can be a filename or a fileglob.
```sh ```shell
git add <pathspec> git add <pathspec>
``` ```
```sh ```shell
git add "30seconds.txt" git add "30seconds.txt"
# Add the file `30seconds.txt` to the staging area # Add the file `30seconds.txt` to the staging area

View File

@ -8,10 +8,10 @@ Switches to an existing branch.
- Use `git checkout <branch>` to switch to the specified branch. - Use `git checkout <branch>` to switch to the specified branch.
- Note: In newer versions of git, you can also use `git switch <branch>`. - Note: In newer versions of git, you can also use `git switch <branch>`.
```sh ```shell
git checkout <branch> git checkout <branch>
``` ```
```sh ```shell
git checkout patch-1 # Switches to the branch named `patch-1` git checkout patch-1 # Switches to the branch named `patch-1`
``` ```

View File

@ -7,11 +7,11 @@ Switches back to the last branch.
- Use `git checkout -` to switch back to the previous branch. - Use `git checkout -` to switch back to the previous branch.
```sh ```shell
git checkout - git checkout -
``` ```
```sh ```shell
git checkout patch-1 git checkout patch-1
git checkout master git checkout master
git checkout - # Switches to `patch-1` git checkout - # Switches to `patch-1`

View File

@ -7,11 +7,11 @@ Undoes a specified commit without rewriting history.
- Use `git revert <commit>` to revert the specified `<commit>`, creating a new commit with the inverse of the commit's changes. - Use `git revert <commit>` to revert the specified `<commit>`, creating a new commit with the inverse of the commit's changes.
```sh ```shell
git revert <commit> git revert <commit>
``` ```
```sh ```shell
git revert 3050fc0d3 git revert 3050fc0d3
# Reverts the commit `3050fc0d3` # Reverts the commit `3050fc0d3`
``` ```

View File

@ -7,11 +7,11 @@ Undoes the last commit without rewriting history.
- Use `git revert HEAD` to revert the last commit, creating a new commit with the inverse of the commit's changes. - Use `git revert HEAD` to revert the last commit, creating a new commit with the inverse of the commit's changes.
```sh ```shell
git revert HEAD git revert HEAD
``` ```
```sh ```shell
git revert HEAD git revert HEAD
# Reverts the last commit # Reverts the last commit
``` ```

View File

@ -8,11 +8,11 @@ Removes files from the staging area.
- Use `git restore --staged <pathspec>` to remove files from the staging area. - Use `git restore --staged <pathspec>` to remove files from the staging area.
- `<pathspec>` can be a filename or a fileglob. - `<pathspec>` can be a filename or a fileglob.
```sh ```shell
git restore --staged <pathspec> git restore --staged <pathspec>
``` ```
```sh ```shell
git restore --staged "30seconds.txt" git restore --staged "30seconds.txt"
# Remove the file `30seconds.txt` from the staging area # Remove the file `30seconds.txt` from the staging area

View File

@ -7,11 +7,11 @@ Updates the last commit's contents without changing its message.
- Use `git commit --amend --no-edit` to add any staged changes to the last commit, without changing its message. - Use `git commit --amend --no-edit` to add any staged changes to the last commit, without changing its message.
```sh ```shell
git commit --amend --no-edit git commit --amend --no-edit
``` ```
```sh ```shell
git add . git add .
git commit -m "Fix the network bug" git commit -m "Fix the network bug"
# Edit or add files # Edit or add files

View File

@ -7,11 +7,11 @@ Updates the last commit's message without changing its contents.
- Use `git commit --amend -m <message>` to replace the last commit's message with the new `<message>`. - Use `git commit --amend -m <message>` to replace the last commit's message with the new `<message>`.
```sh ```shell
git commit --amend -m <message> git commit --amend -m <message>
``` ```
```sh ```shell
git add . git add .
git commit -m "Fix the newtork bug" git commit -m "Fix the newtork bug"
git commit --amend -m "Fix the network bug" git commit --amend -m "Fix the network bug"

View File

@ -8,11 +8,11 @@ Prints a list of all local branches.
- Use `git branch` to display a list of all local branches. - Use `git branch` to display a list of all local branches.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git branch git branch
``` ```
```sh ```shell
git branch git branch
# master # master
# patch-1 # patch-1

View File

@ -8,11 +8,11 @@ Prints a summary of changes between two given commits.
- Use `git shortlog <commit>..<other-commit>` to view a summary of changes between the two given commits. - Use `git shortlog <commit>..<other-commit>` to view a summary of changes between the two given commits.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git shortlog <commit>..<other-commit> git shortlog <commit>..<other-commit>
``` ```
```sh ```shell
git shortlog 3050fc0de..HEAD git shortlog 3050fc0de..HEAD
# Duck Quacking (2): # Duck Quacking (2):
# Fix network bug # Fix network bug

View File

@ -8,11 +8,11 @@ Prints a visual graph of all commits and branches in the repository.
- Use `git log --pretty=oneline --graph --decorate --all` to view a visual graph of the whole repository's history. - Use `git log --pretty=oneline --graph --decorate --all` to view a visual graph of the whole repository's history.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git log --pretty=oneline --graph --decorate --all git log --pretty=oneline --graph --decorate --all
``` ```
```sh ```shell
git log --pretty=oneline --graph --decorate --all git log --pretty=oneline --graph --decorate --all
# * 3050fc0de Fix network bug # * 3050fc0de Fix network bug
# * c191f90c7 Initial commit # * c191f90c7 Initial commit

View File

@ -8,11 +8,11 @@ Prints all commits by the specified author.
- Use `git log --author=<author>` to retrieve all commits by the specified `<author>`. - Use `git log --author=<author>` to retrieve all commits by the specified `<author>`.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git log --author=<author> git log --author=<author>
``` ```
```sh ```shell
git log --author="Duck Quacking" git log --author="Duck Quacking"
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4 # commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code # Author: 30 seconds of code

View File

@ -8,11 +8,11 @@ Prints a list of all commits that manipulated a given string.
- Use `git log -S<string>` to find all commits that manipulated the specified `<string>`. - Use `git log -S<string>` to find all commits that manipulated the specified `<string>`.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git log -S<string> git log -S<string>
``` ```
```sh ```shell
git log -S"30-seconds" git log -S"30-seconds"
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4 # commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code # Author: 30 seconds of code

View File

@ -9,11 +9,11 @@ Prints all commits in the specified date range.
- You can use only `--since=<date-from>` to see all commits since a specific date or only `--until=<date-to>` to view all commits up to a specific date - You can use only `--since=<date-from>` to see all commits since a specific date or only `--until=<date-to>` to view all commits up to a specific date
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git log [--since=<date-from>] [--until=<date-to>] git log [--since=<date-from>] [--until=<date-to>]
``` ```
```sh ```shell
git log --since='Apr 1 2021' --until='Apr 4 2021' git log --since='Apr 1 2021' --until='Apr 4 2021'
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4 # commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code # Author: 30 seconds of code

View File

@ -7,11 +7,11 @@ Prints a short summary of all commits excluding merge commits.
- Use `git log --oneline --no-merges` to list a short summary of all commits without merge commits. - Use `git log --oneline --no-merges` to list a short summary of all commits without merge commits.
```sh ```shell
git log --oneline --no-merges git log --oneline --no-merges
``` ```
```sh ```shell
git log --oneline --no-merges git log --oneline --no-merges
# 3050fc0de Fix network bug # 3050fc0de Fix network bug
# c191f90c7 Initial commit # c191f90c7 Initial commit

View File

@ -7,11 +7,11 @@ Prints a short summary of all commits.
- Use `git log --oneline` to list a short summary of all commits. - Use `git log --oneline` to list a short summary of all commits.
```sh ```shell
git log --oneline git log --oneline
``` ```
```sh ```shell
git log --oneline git log --oneline
# d540ba1ab Merge network bug fix # d540ba1ab Merge network bug fix
# 3050fc0de Fix network bug # 3050fc0de Fix network bug

View File

@ -8,11 +8,11 @@ Displays differences between staged or unstaged changes and the last commit.
- Use `git diff` to view differences between your unstaged changes and the last commit. - Use `git diff` to view differences between your unstaged changes and the last commit.
- You can use the `--staged` option to view differences between your staged changes and the last commit instead. - You can use the `--staged` option to view differences between your staged changes and the last commit instead.
```sh ```shell
git diff [--staged] git diff [--staged]
``` ```
```sh ```shell
git diff git diff
# Displays the differences between unstaged changes and the last commit # Displays the differences between unstaged changes and the last commit

View File

@ -8,11 +8,11 @@ Prints the last commit.
- Use `git log -1` to view the last commit. - Use `git log -1` to view the last commit.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git log -1 git log -1
``` ```
```sh ```shell
git log -1 git log -1
# commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4 # commit c191f90c7766ee6d5f24e90b552a6d446f0d02e4
# Author: 30 seconds of code # Author: 30 seconds of code

View File

@ -8,11 +8,11 @@ Prints a list of all merged local branches.
- Use `git branch -a --merged` to display a list of all merged local branches. - Use `git branch -a --merged` to display a list of all merged local branches.
- Use arrow keys to navigate, press <kbd>Q</kbd> to exit. - Use arrow keys to navigate, press <kbd>Q</kbd> to exit.
```sh ```shell
git branch -a --merged git branch -a --merged
``` ```
```sh ```shell
git checkout master git checkout master
git branch -a --merged git branch -a --merged
# patch-1 # patch-1

View File

@ -7,11 +7,11 @@ Displays the URL of the remote repository.
- Use `git config --get remote.origin.url` to view the URL of the remote repository. - Use `git config --get remote.origin.url` to view the URL of the remote repository.
```sh ```shell
git config --get remote.origin.url git config --get remote.origin.url
``` ```
```sh ```shell
git config --get remote.origin.url git config --get remote.origin.url
# https://github.com/30-seconds/30-seconds-of-code # https://github.com/30-seconds/30-seconds-of-code
``` ```

View File

@ -8,11 +8,11 @@ Prints the current status of the working tree.
- Use `git status` to view the current status of the working tree. - Use `git status` to view the current status of the working tree.
- You can optionally add the `-sb` flag to view the short form of the same output - You can optionally add the `-sb` flag to view the short form of the same output
```sh ```shell
git status [-sb] git status [-sb]
``` ```
```sh ```shell
git status git status
# On branch patch-1 # On branch patch-1
# Your branch is up to date with 'origin/patch-1'. # Your branch is up to date with 'origin/patch-1'.

View File

@ -12,11 +12,11 @@ Because sometimes git log doesn't cut it, especially for commands that don't sho
reflog is basically your safety net after running "scary" commands like git rebase. You'll be able to see not only the commits you made, but each of the actions that led you there. reflog is basically your safety net after running "scary" commands like git rebase. You'll be able to see not only the commits you made, but each of the actions that led you there.
```sh ```shell
git reflog git reflog
``` ```
```sh ```shell
git reflog git reflog
# b6a4f9d6ff9 (HEAD -> patch-1, origin/patch-1) HEAD@{0}: Update docs # b6a4f9d6ff9 (HEAD -> patch-1, origin/patch-1) HEAD@{0}: Update docs
# 3050fc0de HEAD@{1}: rebase -i (finish): returning to refs/heads/patch-1 # 3050fc0de HEAD@{1}: rebase -i (finish): returning to refs/heads/patch-1