INFO1111 Computing 1A Professionalism Computing 1A Professionalism Absolute Git Cheat Shee, Exams of Advanced Education

INFO1111 Computing 1A Professionalism Computing 1A Professionalism Absolute Git Cheat Sheet for June 2026 exam prep University of Sydney

Typology: Exams

2025/2026

Available from 03/02/2026

studyroom
studyroom 🇺🇸

4.2

(5)

6.1K documents

1 / 21

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
INFO1111: Computing 1A Professionalism
Computing 1A Professionalism Absolute Git
Cheat Sheet for June 2026 exam prep
University of Sydney
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15

Partial preview of the text

Download INFO1111 Computing 1A Professionalism Computing 1A Professionalism Absolute Git Cheat Shee and more Exams Advanced Education in PDF only on Docsity!

INFO1111: Computing 1A Professionalism

Computing 1A Professionalism Absolute Git

Cheat Sheet for June 202 6 exam prep

University of Sydney

Learning Git is easier than you think

Muhammad Ahsan Ayaz

Frontend Architect, Author, Google Developers Expert

List all local branches List all remote branches List both local and remote branches git branch git branch --remote git branch - av

Switch to an existing branch Create a new branch Delete a branch locally Delete a remote branch Rename a branch git checkout MY_BRANCH git checkout - b MY_BRANCH git checkout - d MY_BRANCH git push origin --delete MY_BRANCH git branch - m NEW_NAME

Set user name for commits & tags Set user email for commits & tags Set upstream automatically for new branches git config --global user.name “YOUR_NAME“ git config --global user.email “YOUR_EMAIL“ git config --global push.autoSetupRemote true

This is really handy to avoid the error/warning on console that says: Enable colorization of Git output Note: You can avoid the --global flag in all the above commands to set these up within the current git repository only Edit the global config in an editor git config --global color.ui auto git config --global --edit

Reset everything to the last commit Diff of changes (not staged) This shows only the changes which are not staged at the moment Diff of staged code (not committed) This shows only the changes which are staged but not committed at the moment Discard changes in a file (not staged) git reset --hard git diff git diff --staged git restore FILE_PATH

Commit all staged files Add and commit the ‘tracked’ files Note: usually newly created files are not tracked. With git commit - am, they’re not part of the commit Amend the last commit This results in a prompt where you can edit the commit message Reset author of the last commit git commit - m “commit message“ git commit - am “commit message“ git commit --amend git commit --amend --reset-author

Create a .gitignore file at the root of your git project *# Ignores the logs folder and all its files logs/

"!" means don't ignore

!logs/.gitkeep

Ignore Mac system files

.DS_store

Ignore node_modules folder

node_modules** S # ta Ig g no e re a S l A l S f S ile co s nf i i n g t f h il e es current folder **.sass-cache

Ignore all files with specific extensions

*.log *.tmp

Ignore build directories

dist/

Ignore OS-specific files

.DS_Store Thumbs.db

Ignore IDE/editor specific files

.idea/ .vscode/

Ignore environment variable files

.env**

List all remotes linked with local repo Add (link) a new git remote List all remotes with their URLs Remove (unlink) a git remote git remote git remote add REMOTE_NAME REMOTE_URL git remote - v git remote rm REMOTE_NAME

Show commits that changed a file, even across renames Show commits on branchA that are not on branchB Show diff of what is in branchA and is not in branchB Show the last commit and the changes done in it git log --follow FILE_PATH git log BRANCH_B...BRANCH_A git diff BRANCH_B...BRANCH_A git show

Search change in the logs by content Show logs that include changes of a particular file over time Print out a cool visualization of the git log git log - S SEARCH_TERM git log - S 'nodemailer' # example git log - p FILE_PATH git log - p ./app/contact/api.ts #example git log --pretty=oneline --graph --decorate --all

Merge a specific commit from another branch to your current branch Revert a git commit on your current branch Move all your current changes to stash This is really helpful when you want to pull the changes from remote without losing your active changes git checkout YOU_BRANCH git cherry-pick COMMIT_ID git revert COMMIT_ID git add. git stash

See the list of stash file changes in the stack-order (latest first) Apply the changes from the most recent stash (on the top of stash) Discard the most recent stash Remove all the stash items from the list git stash list git stash pop git stash drop git stash clear