0% found this document useful (0 votes)
31 views

Git Cheat Sheet: Create A Repository Work With Change Sync With 'Origin' (Github)

This Git cheat sheet provides commands for initializing and cloning repositories, working with changes by staging and committing files, and syncing repositories by fetching, pulling, and pushing changes. It outlines the basic Git workflow of modifying files in the working directory, staging changes, committing to the local repository, and pushing commits to remote repositories like GitHub. Key commands are shown for initializing a repository, cloning a remote repo, inspecting the status of files, reviewing changes, and syncing a local repo with remote repositories.

Uploaded by

Lucas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Git Cheat Sheet: Create A Repository Work With Change Sync With 'Origin' (Github)

This Git cheat sheet provides commands for initializing and cloning repositories, working with changes by staging and committing files, and syncing repositories by fetching, pulling, and pushing changes. It outlines the basic Git workflow of modifying files in the working directory, staging changes, committing to the local repository, and pushing commits to remote repositories like GitHub. Key commands are shown for initializing a repository, cloning a remote repo, inspecting the status of files, reviewing changes, and syncing a local repo with remote repositories.

Uploaded by

Lucas
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Git Cheat Sheet

Create A Repository Work with change Sync with 'origin' (GitHub)


Initialize a local repo Stage specific files ready for commit Fetch latest changes from 'origin'
$ gi t i ni t $ gi t add <f i l e> $ gi t f et c h

Clone a repo (from GitHub, BitBucket) Stage all files Fetch & Merge latest changes from 'origin'
$ gi t c l one <r epo ur l > $ gi t add . $ gi t pul l

Inspect Repository Commit all staged files to local repo Push local changes to 'origin'
List uncommitted new/modified files $ gi t c ommi t - m ' mes s age' $ gi t pus h
$ gi t s t at us
Add and Commit all tracked files
Show unstaged changes $ gi t c ommi t - am ' mes s age'
$ gi t di f f
Unstage files, but keep changes
Show full change history $ gi t r es et <f i l e>
$ gi t l og $ gi t c hec k out <f i l e>

Show change history for a file Revert everything to last commit


commit -am
$ gi t l og - p <f i l ename> $ gi t r es et - - har d

add commit -m push <rem> <brch>

Working Staging Local Remote


Directory (index) Repository Repository

reset fetch

checkout <file>
reset <commit>

pull

You might also like