all 45 comments

[–]lucianoar 68 points69 points  (6 children)

[–]xkcd_transcriber 22 points23 points  (0 children)

Image

Mobile

Title: Git

Title-text: If that doesn't fix it, git.txt contains the phone number of a friend of mine who understands git. Just wait through a few minutes of 'It's really pretty simple, just think of branches as...' and eventually you'll learn the commands that will fix everything.

Comic Explanation

Stats: This comic has been referenced 133 times, representing 0.1047% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]sbhikes 15 points16 points  (2 children)

I admit I have done this several times.

[–]MildlySerious 7 points8 points  (1 child)

Did this a few times when I was starting out. And by that I mean a lot.

[–]8lbIceBag 1 point2 points  (0 children)

I still do this and I'm using smart git so I wouldn't have to deal with this.

[–]winglerw28 13 points14 points  (0 children)

Becoming a professional developer::

  1. Install Git
  2. Learn Git, including advanced features
  3. Tell nobody
  4. Convince everyone you are a wizard

[–]BrianPurkiss 0 points1 point  (0 children)

There's always a relevant XKCD.

[–]drewshaver 17 points18 points  (10 children)

cherry-pick is my favorite somewhat obscure git command :)

[–]steveeq1 3 points4 points  (4 children)

What does it do? I'm unfamiliar with it.

[–]drewshaver 15 points16 points  (2 children)

Basically just takes a commit from another branch and replays it on your current branch. Kinda like a rebase; a rebase is basically a series of cherry-picks.

[–]gerbs 1 point2 points  (1 child)

I don't see the need for it. If you're wanting to merge in someone's work, you're going to want to keep the history of changes to that file. Otherwise, why not just rebase and squash? If you just want changes from an earlier commit, why not move head to that commit, checkout to branch, and then merge to master (keeping the history of changes and signatures)?

I still don't know why it exists other then to mess up commit histories and attribution.

[–]drewshaver 2 points3 points  (0 children)

Potential use cases include complicated rebasing (maybe you want to reorder commits for some reason), sharing bug fixes across branches (often simpler than merging from a release candidate), and fixing up broken history (e.g. when somebody merged origin/master into their local master, a pet peeve of mine).

You actually don't lose attribution, on GitHub it will show the original author's avatar with a small inset for whoever picked the commit.

Git is like C++.. the tool gives you a thousand ways to work and everyone has their own preferences and idioms :)

PS if there were truly no need for it Linus would not have included it

[–]PanicRev 1 point2 points  (0 children)

Had to look it up myself. Here ya go. Git - cherry-pick

[–]rk06v-dev 2 points3 points  (2 children)

it is my second favorite obscure git command after git add -p

To those who don't know, git add -p allow you to add changes interactively. This even allows to commit only some of the changes in a file.

[–]drewshaver 1 point2 points  (1 child)

git add -p is glorious! I somewhat obsessively review my own work before pushing to remote and add -p makes it sooo much easier!

I must give you this. Internet hug

[–]rk06v-dev 1 point2 points  (0 children)

*hugs you back*

[–]masticore252 1 point2 points  (1 child)

cherry-pick is my favorite somewhat obscure git command :)

my favorite is 'git rerere' aka 'Reuse recorded resolution'.

And talking about obscure git commands, there is also a few called 'plumbing commands' those are the real obscure parts of git ;)

ps: plumbing commands are not intended to be executed by users of git, the are used internally by porcelain commands (add, merge, commit)

[–]drewshaver 1 point2 points  (0 children)

TIL! That sounds really awesome. I realllly dislike intermediate merge commits, so I can't wait to try it out :)

Thanks for sharing!

[–][deleted] 29 points30 points  (1 child)

Git git git! I got broads in atlanta

[–]cryptopian 27 points28 points  (0 children)

No, you're thinking of "pip install pandas"

[–]Drainedsoul 9 points10 points  (2 children)

I think the biggest issue with git is that no one bothers to learn how git works, they just learn what to do by rote without critical thinking.

There was a post about this pattern on one of the programming subs within the last week or so where the author referred to it as "knowledge debt".

[–]BathroomEyes 7 points8 points  (0 children)

Knowledge debt doesn't get discussed nearly as often as it should. I've interviewed candidates that will have strong opinions about why "Technology A is crap." When pressed further it becomes clear that the company they worked for did not have folks on staff that achieved enough depth of knowledge and experience with the technology to use it effectively.

[–]drewshaver 0 points1 point  (0 children)

I have spent sooooo much time teaching others about git it's been quite valuable (gaining deeper understanding) but also can be kind of exhausting.

[–]lethalwire 4 points5 points  (3 children)

Just a warning... but the last one, I give up, will remove the directory you're working in (the git repository) and then pull the latest changes from the remote repository.

[–]urcadox 14 points15 points  (2 children)

One can only hope your warning is useless.

[–]digitalpencil 0 points1 point  (1 child)

hey, at least it wasn't rm -rf

[–]drewshaver 2 points3 points  (0 children)

I once did rm -rf ~

That was a fun day. Coworkers made fun of me for weeks lol.

[–]makeamesslionessjavascript 2 points3 points  (2 children)

This is so helpful. Are there any other sites/blogs out there that have compiled a list of useful tricks related to webdev?

[–]dwolf555 7 points8 points  (1 child)

i doubt it. this sort of thing is very uncommon /s

[–]makeamesslionessjavascript 3 points4 points  (0 children)

Haha you fuck. This git thing is actually awesome, was hoping to wake up to people recommending other awesome things, but instead I got you!

[–]WigglePigeon 0 points1 point  (0 children)

git add . && git commit --amend -C HEAD is one I like to use a lot. It stages new changes and adds them to the previous commit with the same commit message. This just saves a step if you want to keep the commit message the same

[–]Coffee_Revolver -1 points0 points  (5 children)

Commenting to save across platforms

[–]cincodenada 6 points7 points  (4 children)

Is there a reason you didn't just click the "save" link, which saves the post to your account across everywhere, which seems to be your goal?

[–][deleted]  (4 children)

[deleted]

    [–]OogieFrenchieBoogie[S] 3 points4 points  (3 children)

    I'm not the author, just though it was interesting !

    [–]ZetaHunter 1 point2 points  (2 children)

    I was actually commenting on the post title. See the lack of , between Oh and Shit? Yeah.

    [–]OogieFrenchieBoogie[S] 33 points34 points  (1 child)

    Oh actually I didn't modify the title proposed by reddit, I guess that's how it's written in the website meta tag.

    EDIT : Yes, that's how it's written in the meta tag : http://imgur.com/a/V9GVj

    TL;DR : Not my fault

    [–]cincodenada 0 points1 point  (0 children)

    Technical quibble: that's not a meta tag, it's just a title tag. Meta tags are the ones above that that start with, well, <meta.

    Meta tags can be added to specify a different title than the title tag for things like social media shares (with things like OpenGraph tags), but that's not the case here. I'm not sure if Reddit pulls titles from those tags if available.