From 6638bd9f36c630a2e4707060f8288828a43b90a7 Mon Sep 17 00:00:00 2001 From: Ana Castaneda Date: Wed, 29 May 2024 15:17:17 -0600 Subject: [PATCH 1/2] Added examples to Git commands mini-reference section --- foundations/github/basic-git.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/foundations/github/basic-git.md b/foundations/github/basic-git.md index 5b1c9a4f1..02fc81a06 100644 --- a/foundations/github/basic-git.md +++ b/foundations/github/basic-git.md @@ -410,10 +410,26 @@ The `git diff` command is a powerful comparison tool (and maybe your second new - `git status`: see what branch we're on and what state our repo is in. - `git checkout`: switch between branches (use the `-b` flag to create a new branch and check it out) +```bash + git checkout -b new-branch-name + git checkout + git checkout branch-name +``` - `git diff`: compare files between current version and last commit (default), between two commits, or between two branches. +```bash + git diff commit-one commit-two + git diff branch-one..branch-two +``` - `git add`: stage a file for a commit. +```bash + git add file-name +``` - `git commit`: create a new commit with the staged files. -- `git log`: see the commit history of our branch. +```bash + git commit -m 'message/comment between quotation marks' +``` +- `git log`: see the commit history of our branch. + - Press `Q` to exit ### Some other git commands you'll want to know From 2208e4416c6ab5b1485cd8356ca91276c8c8c53c Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 31 May 2024 19:52:03 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- foundations/github/basic-git.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/foundations/github/basic-git.md b/foundations/github/basic-git.md index 02fc81a06..5b0f888eb 100644 --- a/foundations/github/basic-git.md +++ b/foundations/github/basic-git.md @@ -410,26 +410,34 @@ The `git diff` command is a powerful comparison tool (and maybe your second new - `git status`: see what branch we're on and what state our repo is in. - `git checkout`: switch between branches (use the `-b` flag to create a new branch and check it out) + ```bash git checkout -b new-branch-name git checkout git checkout branch-name ``` + - `git diff`: compare files between current version and last commit (default), between two commits, or between two branches. + ```bash git diff commit-one commit-two git diff branch-one..branch-two ``` + - `git add`: stage a file for a commit. + ```bash git add file-name ``` + - `git commit`: create a new commit with the staged files. + ```bash git commit -m 'message/comment between quotation marks' ``` -- `git log`: see the commit history of our branch. - - Press `Q` to exit + +- `git log`: see the commit history of our branch. + - Press `Q` to exit ### Some other git commands you'll want to know