From b03381d16eb4ff09bb4ed29bf69f3075c180c119 Mon Sep 17 00:00:00 2001 From: adamnaza Date: Mon, 13 Oct 2025 22:27:32 -0400 Subject: [PATCH 1/2] added git-cheatsheet.typ --- git-cheatsheet.typ | 112 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 git-cheatsheet.typ diff --git a/git-cheatsheet.typ b/git-cheatsheet.typ new file mode 100644 index 0000000..8af02b2 --- /dev/null +++ b/git-cheatsheet.typ @@ -0,0 +1,112 @@ +#set page( + width: 297mm, + height: 210mm, + margin:( + top: 0.5cm, + bottom: 0.5cm, + left: 0.5cm, + right: 0.5cm, + ) +) +#set text(font: "Times New Roman", size: 8pt) +#set heading(numbering: "1.") +#show link: set text(fill: blue) +#show strong: set text(weight: "semibold") + +#align(center, text(14pt)[*Git Cheatsheets*]) + +*Installation* \ +*macOS* +- 'xcode -select --install' or 'brew install git' +- Verify: 'git --version' +*Linux* +- Debian/Ubuntu: 'sudo apt install git' +- Fedora: 'sudo dnf install git' +- Arch: 'sudo pacman -S git' +- Verify: 'git --version' +*Windows* +- Download installer from [https://git-scm.com/download/win] += Quick Start +#table( + table.header([*Command*], [*Description*]), + columns: 2, + align: horizon, + inset: 6pt, + rows: auto, + [`git config --global user.name "Your Name"`\ ],[& Set your display name for commits.], + [`git config --global user.email "you@example.com"`\ ],[ & Set your email for commits.\ ], + [`git config --global init.defaultBranch main` ], [& Use `main` for new repos. \ ], + [`git config --global color.ui auto`],[& Enable colored CLI output. ], + [`git init`],[ Initialize a new repo in the current directory], + [`git clone `],[Create a local copy of remote repo], + [`git remote add origin `],[Add a remote named `origin`], + [`git remote -v`], [Show remotes and their URLs.] +) + + +/* +Commands for Branch & Merging section; +git banch, git branch [branch-name], git checkout, git merge []branch-name], git log +*/ + += Branch & Merge +#table( + table.header([*Command*],[*Description*]), + columns: 2, + align: horizon, + inset:6pt, + rows: auto, + [`git branch`],[List local branches.], + [`git branch `],[Create a new branch.], + [`git switch `],[Switch to an existing branch.], + [`git switch -c `],[Create and switch to a new branch.], + [`git merge `],[Merge into the current branch.], + [`git rebase `],[Replay current commits on top of .], + [`git log --oneline --graph --decorate`],[View compact commit graph.], + +) + += Inspect & Compare +#table( + table.header([*Command*],[*Description*]), + columns: 2, + align : horizon, + inset: 6pt, + rows: auto, + +) + += Share & Update +#table( + table.header([*Command*],[*Description*]), + columns: 2, + inset:6pt, + rows: auto, + align: horizon, + [`git fetch`],[Download updates from remote (no integrate).], + [`git pull`],[Fetch and integrate into current branch.], + [`git push`],[Upload local commits to remote.], + [`git push -u origin `],[Push and set upstream for .], + [`git fetch --prune`],[Remove refs deleted on remote.], +) + += Rewriting Git History +#table( + table.header([*Command*],[*Description*]), + columns: 2, + align: horizon, + inset:6pt, + rows: auto, + [],[], + +) + += Temporary Commits: storing your temp work +#table( + table.header([*Command*],[*Description*]), + columns: 2, + align: horizon, + inset:6pt, + rows: auto, + [],[], +) \ No newline at end of file From 154fdcf9d5279fda6156b30364ea40648cb99848 Mon Sep 17 00:00:00 2001 From: adamnaza Date: Mon, 13 Oct 2025 23:28:15 -0400 Subject: [PATCH 2/2] updated cheatsheet --- git-cheatsheet.typ | 56 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/git-cheatsheet.typ b/git-cheatsheet.typ index 8af02b2..0b5e2a1 100644 --- a/git-cheatsheet.typ +++ b/git-cheatsheet.typ @@ -6,7 +6,8 @@ bottom: 0.5cm, left: 0.5cm, right: 0.5cm, - ) + ), + columns: 2, ) #set text(font: "Times New Roman", size: 8pt) #set heading(numbering: "1.") @@ -15,6 +16,7 @@ #align(center, text(14pt)[*Git Cheatsheets*]) + *Installation* \ *macOS* - 'xcode -select --install' or 'brew install git' @@ -33,17 +35,16 @@ align: horizon, inset: 6pt, rows: auto, - [`git config --global user.name "Your Name"`\ ],[& Set your display name for commits.], - [`git config --global user.email "you@example.com"`\ ],[ & Set your email for commits.\ ], - [`git config --global init.defaultBranch main` ], [& Use `main` for new repos. \ ], + [`git config --global user.name "Your Name"`],[ Set your display name for commits.], + [`git config --global user.email "you@example.com"` ],[Set your email for commits.], + [`git config --global init.defaultBranch main` ], [Use `main` for new repos.], [`git config --global color.ui auto`],[& Enable colored CLI output. ], - [`git init`],[ Initialize a new repo in the current directory], - [`git clone `],[Create a local copy of remote repo], + [`git init [project-name]`],[ Initialize a new repo in the current directory], + [`git clone `],[Create a local copy of remote repo], [`git remote add origin `],[Add a remote named `origin`], [`git remote -v`], [Show remotes and their URLs.] ) - /* Commands for Branch & Merging section; git banch, git branch [branch-name], git checkout, git merge []branch-name], git log @@ -66,6 +67,8 @@ git banch, git branch [branch-name], git checkout, git merge []branch-name], git ) + +#colbreak() = Inspect & Compare #table( table.header([*Command*],[*Description*]), @@ -73,8 +76,13 @@ git banch, git branch [branch-name], git checkout, git merge []branch-name], git align : horizon, inset: 6pt, rows: auto, - + [`git log`],[Show the commit history for the currently active branch.], + [`git log branchB..branchA`],[Show the commits on branchA that are not on branchB.], + [`git log --follow [file]`],[Show the commits that changed file, even across renames.], + [`git diff branchB...branchA`],[Show the diff of what is in branchA that is not in branchB.], + [`git show [SHA]`],[Show any object in Git in human-readable format.], ) + = Share & Update #table( @@ -97,7 +105,11 @@ git banch, git branch [branch-name], git checkout, git merge []branch-name], git align: horizon, inset:6pt, rows: auto, - [],[], + [`git commit --amend`],[Edit the last commit message or content.], + [`git rebase -i `],[Interactively rebase commits onto .], + [`git reset --soft `],[Move HEAD, keep changes staged.], + [`git reset --hard `],[Move HEAD, discard all changes.], + [`git revert `],[Create a new commit that undoes .], ) @@ -108,5 +120,27 @@ git banch, git branch [branch-name], git checkout, git merge []branch-name], git align: horizon, inset:6pt, rows: auto, - [],[], -) \ No newline at end of file + [`git stash`],[Save changes for later, keep working directory clean.], + [`git stash pop`],[Re-apply the most recent stash and remove it.], + [`git stash list`],[Show all stashed changes.], + [`git stash drop`],[Delete a stash entry.], +) + +#colbreak() +// tagging commits + = Tagging Commits +#table( + table.header([*Command*],[*Description*]), + columns: 2, + inset: 6pt, + align: horizon, + rows: auto, + [`git tag`],[List all tags in the repository.], + [`git tag [name] [commit sha]`],[Create a new tag at the specified commit (or HEAD if omitted).], + [`git tag -d [name]`],[Delete a local tag.], + [`git push origin [name]`],[Push a specific tag to the remote repository.], + [`git push origin --tags`],[Push all local tags to the remote repository.], +) + + +