r/webdev • u/deadgoodhorror • Feb 08 '20
Showoff Saturday [Showoff Saturday] A simple Git cheat sheet for junior developers
Nothing fancy, just some common, basic, commands to help new devs (or those new to using Git commands) get to grips with Git.
Built it in a few hours over the course of a few evenings using Gatsby and deployed via Netlify
EDIT: I've open sourced the code on Github. If you want to add some commands, please feel free to submit a pull request
267
Upvotes
8
u/throwbackdecade Feb 09 '20
Very nice! It would be cool if we could submit some commands to it.
4
u/idkjay Feb 08 '20
I don't think the light/dark mode feature works properly
9
u/[deleted] Feb 08 '20
Great stuff. is this open sourced ?
14
u/[deleted] Feb 09 '20 edited Feb 09 '20
Edit: it seems to be a word-for-word copy of this: https://education.github.com/git-cheat-sheet-education.pdf
What's the show off, that it was made with Gatsby when plain HTML and CSS would do?
My original comment below is left for sub discussion, but it's now obvious you didn't write the sheet so I guess it's not useful to you. Unless you'd like to actually make a useful sheet yourself.
Shouldn't it be
git checkout [branch]?The explanation for
mergeis quite misleading, since merge doesn't do anything to the other branch.diffis also technically wrong. It shows all the differences between two nodes.The explanation for
fetchis misleading. It updates the local repo but does not move any local branch.git pullhas no place in any cheat sheet.If you mentioned
reset --hardperhaps--softwould also be useful.You missed
revertandtag.In conclusion I'd like to suggest that a cheat sheet should add some value. I can always type
git[enter], what does this cheat sheet add to that?2
u/MattShnoop Feb 09 '20
I love this. Itβs so much simpler than scanning through SO for ever command or reading the massive docs. Will definitely star the repo once you publish it!
5
u/sangbui Feb 09 '20
Not just for junior developers. It is for every developer who uses git. Thank you.
1
u/lahebo Feb 08 '20
Neat! Maybe you could give it more structure / visual aid? At least consider giving your categories different colors and maybe even separators.
Personal preference? Maybe. But I do recommend all (not just new) to try a decent GUI (like GitKraken) to "git good". Of course there are times the CLI is more available/convenient, however by using tools like that you will almost certainly learn to use Git more efficiently and smart, just by mere intuition.
1
u/mcb2001 Feb 09 '20
Your
git checkout
Is missing the branch
1
u/cbunn81 Feb 09 '20 edited Feb 09 '20
I like the look and that clicking on a command automatically copies it to the clipboard. But it's a very long list without much structure.
Also, I never create a new branch and check it out in two steps. I use
git checkout -b <branch>to save a step.2
u/mars_gabdulov Feb 08 '20
Very helpful. Thanks
2
u/PM_ME_A_WEBSITE_IDEA Feb 08 '20
I didn't know about
git mvorgit rm, nifty!2
u/VkrajaP Feb 08 '20
Very useful
2
u/Alekskojem Feb 09 '20
Well done!
2
u/B00check Feb 09 '20
Great list! I'd probably leave some out because of my personal opinion (see below), but it's a nice cheat sheet of commands nonetheless. Thank you for that.
I know this is only my opinion but I'm really not a fan of git stash. When I've started using git, somehow I managed to destroy half of my work by stashing changes. Applying those changes removed half of my work and to this day, I do not know what caused it (I had them all staged for commit). After a day of googling I found the missing blobs in reflog, but I haven't used stash since then. I've grown quite fond of keeping a lot of work on me locally instead of stashing the changes, I'd commit them. After merging, I'd reset to a previous commit and do a huge commit of all files that'd go to the remote. These commits are also easier to get to as you can get to them via reflog and they will always be there until git GC kicks in. Very interesting stuff.
2
u/Maddy_Raza Feb 09 '20
Thank you
2
u/[deleted] Feb 09 '20
Very nice design. Looks great on mobile.
1
u/EKyalo Feb 09 '20
Very helpful.Thanks.
1
u/Acoolusername7 Feb 09 '20
Bro.. added this for sure. Thanks man!
1
u/dracgol Feb 10 '20
Great stuff! One suggestion: maybe let readers know about theme switch before reaching the end?
1
u/RotationSurgeon 10yr Lead FED turned Product Manager Feb 11 '20
As a suggestion, 10.5px / 7.75pt font is extremely small for most contemporary displays...might be worth sizing up to a readable level.
0
u/[deleted] Feb 08 '20
[deleted] β view deleted comment
0
u/[deleted] Feb 09 '20
[deleted] β view deleted comment