Skip to content

Commit f24a3a8

Browse files
Added examples to Git commands mini-reference section (ProjectPythia#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>
1 parent 2101e01 commit f24a3a8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

foundations/github/basic-git.md

+24
Original file line numberDiff line numberDiff line change
@@ -410,10 +410,34 @@ The `git diff` command is a powerful comparison tool (and maybe your second new
410410

411411
- `git status`: see what branch we're on and what state our repo is in.
412412
- `git checkout`: switch between branches (use the `-b` flag to create a new branch and check it out)
413+
414+
```bash
415+
git checkout -b new-branch-name
416+
git checkout <unique-code-of-commit>
417+
git checkout branch-name
418+
```
419+
413420
- `git diff`: compare files between current version and last commit (default), between two commits, or between two branches.
421+
422+
```bash
423+
git diff commit-one commit-two
424+
git diff branch-one..branch-two
425+
```
426+
414427
- `git add`: stage a file for a commit.
428+
429+
```bash
430+
git add file-name
431+
```
432+
415433
- `git commit`: create a new commit with the staged files.
434+
435+
```bash
436+
git commit -m 'message/comment between quotation marks'
437+
```
438+
416439
- `git log`: see the commit history of our branch.
440+
- Press `Q` to exit
417441

418442
### Some other git commands you'll want to know
419443

0 commit comments

Comments
 (0)