0% found this document useful (0 votes)
119 views2 pages

Git-Cheat-Sheet-Education - Git-Cheat-Sheet-Education

Uploaded by

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

Git-Cheat-Sheet-Education - Git-Cheat-Sheet-Education

Uploaded by

asd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Ceti ts) GIT CHEAT SHEET Git is the free and open source distributed version control system that's responsible for everything GitHub related that happens locally on your computer. This cheat sheet features the most important and commonly used Git commands for easy reference. INSTALLATION & GUIS ‘With platform specific installers for Git, GitHub also provides the ‘ease a staying up-to-date withthe latest releases ofthe command line tool wile providing a graphical user interface For day-to-day interaction, review, and repositary synchronization. GitHub for Windows hittps//windowsgithub.com GitHub for Mac https//macgithub.com For Linux and Solaris platforms, the latest release is available on the official Gitweb site, Giefor AlPlatforms Intp/feit-semeom ‘SETUP Configuring user information used across ll acalrepositories git contig --olobal user.nane “[firstnane lastnane]” set aname that is identifiable fr credit when review versionhistory git contig ~ lobal user.omail “[valid-emait]" set an email address that willbe associatedwith each history marker git config --global color.ui auto set automatic command line coloring for Git for easy reviewing ‘SETUP & INIT Configuring user information, initializing and cloning repositories git nie initialize an existing directory as aGit repository git clone Curt} retrieve anentire repository fram ahasted location via URL STAGE & SNAPSHOT Working with snapshots and the Git staging area ‘ott status, show modified files in working directory, staged for your next commit ‘git add [file] add afileasitlooks naw to your next commit (stage) git reset [file] unstage afile while retaining the changes in working directory git aiee diff of what is changed but not staged git diff --staged dif of whats staged but nat yet committed git comit [descriptive message)” commit your staged content as anew commit snapshot BRANCH & MERGE Isolating workin branches, changing context, and integrating changes. it branch listyourbranches. a will appear nextto the currently active branch ‘git branch [branch-name] create anewbranch at the current commit ‘git checkout ‘itch to another branch andcheckit autinto your working directory ‘git merge [branch] ‘merge the specified branch’ history into the current ane. ‘tt Log showall commitsinthe current branch's history ty) INSPECT & COMPARE SHARE & UPDATE Examining logs, cliffs and object information Retrieving updates from another repository andupdating local repos aft Log git remote add [alias] Curt] shaw the commit history for the currently active branch ‘adda git URLas an alias ‘git Log branchB. -branchA git fetch [alias] shaw the commits on branchA that are not on branchB fetch dow allthe branches from that Gitremote git log --follow [file] ‘git merge [alias]/[branch] show the commits that changed fie, even across renames. ‘mergea remote branch into your current branch tobringitup to date git diet branche. ‘branchA ‘git push [alias] [branch] show the diffof what isinbranchA thats natin branch Transmit local branch commits tothe remate repasitory bench git show [SHA] oit putt showany object Gitin human-readable format fetch and merge any commits from the trackingremote branch TRACKING PATH CHANGES REWRITE HISTORY Versioning file removes and path changes Revwritingbranches, updatingcommits and clearing history ott mm [eitey oft rebase [branch] delet the fle rom project and stage the removal for commit -pply any commits of currentbranch ahead specified one it mv [existing-pathn] [new-path] out reset --hard [comit] Fe eat tenon clear staging are, rerite working tree from specified commit git log --stat - showallcommitogs with indication of any paths that moved ‘TEMPORARY COMMITS Temporarily store mocifed tracked les inorder tochangebranches IGNORING PATTERNS ait stash Preventing unintentional tagingor commitingof files Save modified and staged changes Logs oft stash Use notes pattern*/ lst stack-order of stashed filechanges Savea file with desired patterns as gltignore with eitherdirectstring 92 StASH POP: matches or wildcard globs. write working from top of stash stack a1 config --global core.excludesfite [file] git stash drop system wide ignore patern fr alllocal repositories dliscard the changes fromtopof stash stack GitHub Education ‘Teach and learn better, together. GitHub is free for students and teach- 1 [email protected] ers, Discounts available for other educational uses. © education github.com

You might also like