From f24a3a89f265394086cd4f958b3e18ed14e533e1 Mon Sep 17 00:00:00 2001 From: anacmontoya <142039433+anacmontoya@users.noreply.github.com> Date: Mon, 3 Jun 2024 16:19:53 -0600 Subject: [PATCH] Added examples to Git commands mini-reference section (#474) * Added examples to Git commands mini-reference section * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- foundations/github/basic-git.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/foundations/github/basic-git.md b/foundations/github/basic-git.md index 5b1c9a4f1..5b0f888eb 100644 --- a/foundations/github/basic-git.md +++ b/foundations/github/basic-git.md @@ -410,10 +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 ### Some other git commands you'll want to know