├── .github └── FUNDING.yml ├── .sparkleshare ├── preview.png ├── git-cheat-sheet.pdf ├── README.md ├── SparkleShare.txt └── git-cheat-sheet.svg /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: hbons 2 | -------------------------------------------------------------------------------- /.sparkleshare: -------------------------------------------------------------------------------- 1 | 67c2fd27223a374c8dbc79e0db866a84a748a67e -------------------------------------------------------------------------------- /preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hbons/git-cheat-sheet/HEAD/preview.png -------------------------------------------------------------------------------- /git-cheat-sheet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hbons/git-cheat-sheet/HEAD/git-cheat-sheet.pdf -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # A cheat sheet for Git workflows 2 | 3 | ![Git Cheat Sheet](https://raw.githubusercontent.com/hbons/git-cheat-sheet/master/preview.png) 4 | 5 | Made by Hylke Bons based on work by Zack Rusin and Sébastien Pierre. 6 | This work is licensed under the Creative Commons Attribution 3.0 License. 7 | 8 | Make sure to have [Droid Sans](https://www.google.com/fonts#UsePlace:use/Collection:Droid+Sans:400,700) installed. 9 | 10 | -------------------------------------------------------------------------------- /SparkleShare.txt: -------------------------------------------------------------------------------- 1 | Congratulations, you've successfully created a SparkleShare repository! 2 | 3 | Any files you add or change in this folder will be automatically synced to 4 | ssh://git@github.com/hbons/git-cheat-sheet and everyone connected to it. 5 | 6 | SparkleShare is a Free and Open Source software program that helps people 7 | collaborate and share files. If you like what we do, please consider a small 8 | donation to support the project: http://sparkleshare.org/support-us/ 9 | 10 | Have fun! :) 11 | -------------------------------------------------------------------------------- /git-cheat-sheet.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 25 | 27 | 51 | 66 | 67 | 69 | 70 | 72 | image/svg+xml 73 | 75 | 77 | 78 | 79 | 81 | 83 | 85 | 87 | 89 | 91 | 92 | 93 | 94 | 99 | 105 | 111 | 117 | 123 | 129 | 135 | 141 | 147 | 153 | 159 | 165 | 171 | 180 | 189 | 198 | 207 | 216 | 225 | 234 | 237 | 242 | 247 | 252 | 257 | 262 | 267 | 272 | 277 | 282 | 287 | 292 | 297 | 302 | 303 | From existing repository 314 | From existing data 325 | cd ~/my_project_directorygit initgit add . 352 | git clone ~/existing_repo ~/new/repogit clone git://host.org/project.gitgit clone ssh://user@host.org/project.git 374 | Global configuration is stored in ~/.gitconfig. git config --help 390 | Files changed in working directory 401 | A specific file from a specific ID 412 | Changes made to tracked files 423 | git status 435 | git diff 452 | git show <ID>:<FILE> 464 | All local branches 475 | git branch 487 | History of changes 498 | git log 515 | Who changed what and when in a file 526 | git blame <FILE> 543 | What changed between ID1 and ID2 554 | git diff <ID1> <ID2> 571 | History of changes for file with diffs 582 | git log -p <FILE> <DIRECTORY> 599 | A commit identified by ID 610 | git show <ID> 622 | star (*) marks the current branch 633 | PUBLISH 645 | COMMIT 657 | commit 670 | REVERT 682 | BRANCH 694 | BROWSE 707 | UPDATE 719 | CREATE 731 | statuslogshowdiffbranch 769 | pullfetchmergeam 802 | pushformat-patch 820 | initclone 838 | checkoutbranch 856 | 865 | CHANGE 877 | 880 | Create 895 | 898 | 908 | 918 | 937 | 938 | 939 | Made by Hylke Bons based on work by Zack Rusin and Sébastien Pierre. This work is licensed under the Creative Commons Attribution 3.0 License. 950 | 953 | Show 964 | 967 | 977 | 987 | 1006 | 1007 | 1008 | master is the default development branch.origin is the default upstream repository. 1027 | Return to the last commited state 1038 | Revert the last commit 1049 | git reset --hard 1061 | git revert HEAD 1078 | Fix the last commit 1089 | git commit -a --amend 1101 | Revert specific commit 1112 | git revert <ID> 1124 | Checkout the ID version of a file 1135 | git checkout <ID> <FILE> 1147 | 1150 | Revert 1161 | 1164 | 1174 | 1184 | 1203 | 1204 | 1205 | This cannot be undone! 1216 | Creates a new commit 1227 | Creates a new commit 1238 | (after editing the broken files) 1249 | Fetch latest changes from origin 1260 | Pull latest changes from origin 1271 | git fetch 1283 | git pull 1295 | git am --resolved 1307 | Apply a patch that someone sent you 1318 | git am -3 patch.mbox 1330 | 1333 | Update 1344 | 1347 | 1357 | 1367 | 1386 | 1387 | 1388 | (this does not merge them) 1399 | (does a fetch followed by a merge) 1410 | In case of conflict, resolve the conflict and 1421 | Commit all your local changes 1432 | Prepare a patch for other developers 1443 | git commit -a 1455 | git format-patch origin 1467 | Make a version or milestone 1478 | git tag v1.0 1490 | Push changes to origin 1501 | git push 1513 | 1516 | Publish 1527 | 1530 | 1540 | 1550 | 1569 | 1570 | 1571 | 1574 | Workflow 1585 | 1588 | 1598 | 1608 | 1627 | 1628 | 1629 | resetcheckoutrevert 1652 | Switch to a branch 1663 | Merge BRANCH1 into BRANCH2 1674 | git checkout <BRANCH> 1686 | git checkout <BRANCH2>git merge <BRANCH1> 1703 | Create branch BRANCH based on OTHERand switch to it 1718 | git checkout -b <BRANCH> <OTHER> 1730 | Create branch BRANCH based on HEAD 1741 | git branch <BRANCH> 1753 | 1756 | Branch 1767 | 1770 | 1780 | 1790 | 1809 | 1810 | 1811 | Delete branch BRANCH 1822 | git branch -d <BRANCH> 1834 | View merge conflicts 1845 | View merge conflicts against base file 1856 | git diff 1868 | git diff --base <FILE> 1880 | 1883 | Resolve merge conflicts 1894 | 1897 | 1907 | 1917 | 1936 | 1937 | 1938 | View merge conflicts against your changes 1949 | git diff --ours <FILE> 1961 | View merge conflicts against other changes 1972 | git diff --theirs <FILE> 1984 | Discard a conflicting patch 1995 | git reset --hardgit rebase --skip 2012 | After resolving conflicts, merge with 2023 | git add <CONFLICTING_FILE>git rebase --continue 2040 | Remember! git <COMMAND> --help 2056 | 2057 | 2058 | --------------------------------------------------------------------------------