Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 1 out of 4 pages
Other

WGU D197 Git Cheat Sheet | Essential Commands, Version Control and OA Exam Review | 2026 Updates | 100% correct

Document preview thumbnail
Preview 1 out of 4 pages

WGU D197 Git Cheat Sheet | Essential Commands, Version Control and OA Exam Review | 2026 Updates | 100% correct

Content preview

git--print-out Git Cheat Sheet
Ways to refer to a
Move Between Branches commit
Getting Started Start a Edit History
Switch branches: Every time we say
<commit>, you can use
new repo:
git switch <name> "Undo" the any
mostof
recent commit (keep your working
git init these: directory the same):
OR git checkout git reset HEAD^
Clone an existing repo: <name> ★a branch main
git clone <url> Squash the last 5 commits into one:
Create a branch: ★a tag v0.1 git rebase -i HEAD~6
git switch -c <name> ★a commit ID 3e887ab
Then change "pick" to "fixup" for any commit you want
OR git checkout -b
Prepare to Commit ★a remote branch origin/main
to combine with the previous one Undo a failed
<name>
Add untracked file or unstaged changes: ★ current commit HEAD rebase:
git add <file> List branches: git ★ 3 commits git reflog BRANCHNAME
ago HEAD^^^ or HEAD~3
branch
Add all untracked files and unstaged changes: Then manually find the right commit ID in the reflog,
git add . List branches by most recently committed to: then run:
git branch --sort=-committerdate git reset --hard <commit>
Choose which parts of a file to stage:
-p Delete a branch: Change a commit message (or add a file you forgot):
git branch -d <name> Discard Your Changes git commit --amend
Move file:
git mv <old> <new> Force delete a branch: git Delete unstaged changes to one file:
branch -D <name> git restore <file>
Delete file: OR git checkout
git rm <file> Code Archaeology
<file>
Tell Git to forget about a file without deleting it: Look at a branch's history:
Delete all staged and unstaged changes to one file:
Diff Staged/Unstaged Changes
rm --cached <file> git restore --staged --worktree git log <file>
main git log
Diff all staged and unstaged changes:
Unstage one file: git git diff HEAD OR git checkout HEAD --graph main git log
reset <file> <file> --oneline
Diff just staged changes: git
Unstage everything: git diff --staged Show every commit that modified a file:
Delete all staged and unstaged changes:
reset git reset --hard git log <file>
Diff just unstaged changes:
Check what you added: git diff Delete untracked files: git Show every commit that modified a file, including
git status clean before it was renamed:
git log --follow <file>
'Stash' all staged and unstaged changes:
git stash Find every commit that added or removed some text:
Diff Commits git log -G banana
Show diff between a commit and its parent:
git show <commit> Show who last changed each line of a file:
Make Commits git blame <file>
Make a commit (and open text editor
Diff two
to write
commits:
message): git commit git diff <commit> <commit>

Make a commit: Diff one file since a commit:
git commit -m 'message' git diff <commit> <file>

Commit all unstaged changes: Show a summary of a diff: git
commit -am 'message' diff <commit> --stat git
show <commit> --stat

Document information

Uploaded on
June 9, 2026
Number of pages
4
Written in
2025/2026
Type
Other
Person
Unknown
$15.49

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Nipsey
4.1
(377)
Sold
2127
Followers
1528
Items
15244
Last sold
4 days ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions