computer science, research

The Basics of Git Flow

The following is an introduction to the basics of Git and Git Flow:

What are Git and Git Flow?

  • Git is a version control system for tracking changes in files
    • Sort of like Dropbox, people can make changes to files and folders and their teammates can stay up to date with those changes
    • Can be controlled via the command line, your IDE, an external tool, and probably multiple other ways I’m not familiar with
      • I recommend an external tool, I use SourceTree and reference it a few times within this document.
  • Git Flow is a standard set of guidelines for using Git
    • Makes it easier to coordinate work and avoid accidental loss of files/changes
    • Takes some getting used to, but ultimately makes your life easier

potcguidelines

The key word in the definition of Git Flow is guidelines, but while they are not strictly enforced rules, they are the most widely accepted way of organizing Git within the industry.

Terminology

  • repository – where all the code is stored (kinda like a folder in Dropbox)
  • branch – where a specific version of the code is (like a folder within the Dropbox folder)
  • commit – small change in code saved on a branch
  • local – code/branches/commits saved on your computer
  • remote – code/branches/commits not saved on your computer
  • head – the commit you are working on currently
  • checkout – switches the current branch
  • clone – making a local copy of the repo, with the ability to add to/change it
  • merge – combining the code of 2 branches together
  • fetch – gets remote commits of a branch (doesn’t merge)
  • pull – fetches and merges commits from other branches
  • push – adds your local commits to the remote branch for others to pull

Simplified Workflow

Here is a simplified workflow of branching, committing, etc. This is similar to the visual tree view you would see within Source Tree. A solid dot represents a commit. A commit with a white dot on it represents the head, or current commit. A line between two commits shows their connection, either on the same branch, one is branched off of the other, or one is merged into the other (I think it’ll make sense once you look at it).

Screen Shot 2017-10-17 at 12.56.10 PM

Branches and Commits Conventions

When you create a branch you must give it a name and when you commit code you must include a commit message, here are some guidelines on naming branches and writing commit messages:

  • Branches should only accomplish one thing and be named as such
    • Not your name or something encompassing multiple features
      • (Unless maybe it is a sub branch to work of off for that piece, though I’d suggest a directory instead e.g. post-comment branched off of backend vs backend/post-comment)
    • Bad Branch Names: rachels-branch, backend
    • Good Branch Names: login-screen-ui, get-userid
  • Commits should only do one thing and messages should be in the present tense beginning with a verb
      • ‘add sort function’ NOT ‘added sort function and…’

Stash, Reset, & Revert

Mistakes happen, but these are three ways to help fix them! I have a hard time describing these, so I’ve taken definitions from some of Atlassian’s Git Tutorials and linked to each of them

  • Stash
    • “temporarily shelves (or stashes) changes you’ve made to your working copy so you can work on something else, and then come back and apply them later on”
    • More details
  • Reset
    • “a simple way to undo changes that haven’t been shared with anyone else”
    • More details
  • Revert
    • “undoes a commit by creating a new commit”
    • More details

Merging

Merging branches happens when you finish a feature on that branch and want to combine it with your teammates’ code on another branch. Here’s a little step-by-step on how to merge:

Screen Shot 2017-10-17 at 10.36.11 AM.png

  1. Commit changes, fetch parent branch (Develop in this example), and merge it into child branch (the 2nd Feature branch)
  2. Fix any conflicts and ensure everything is still working as intended
  3. Merge child branch into parent branch
  4. (Optional) If you’re done with the feature, “prune the branch” but do not Force Delete

Merge Conflicts

This is often the scariest part of using git. Everything’s fine, you’re getting work done, when suddenly you get a merge conflict and you have to stop everything to try and fix it. It seems so complicated! What causes this? More importantly, how do you fix it?

First off, “a merge conflict happens when two branches both modify the same region of a file and are subsequently merged. Git can’t know which of the changes to keep, and thus needs human intervention to resolve the conflict” – Stack Overflow answer from user Caleb

So a scenario in which this would occur would be if you and a co worker are working on separate features within in the same file. Your co worker writes a function on line 86 and commits it on his branch. You also add a different function on line 86. When it’s time to merge, conflicts happen because you both added different code on the same line!

So how do you fix merge conflicts? Well, there are a couple different ways,

  1. You can directly edit the affected code. This is what I suggest in most cases. Even with conflicts, all of the code is still within the files. When a conflict happens it gets marked with a bunch of ‘’s, “HEAD”, and a long string of random characters this is just to show you and git that there is a problem here:Screen Shot 2017-10-17 at 1.20.27 PM.png
  2. In Source Tree, you can right click the conflicting files and choose to “Resolve Using Mine” or “Resolve Using Theirs.” This will keep only one version of the conflicting code. “Mine” is the version of the current branch, which you are trying to merge something into. “Theirs” is the version of the branch you are trying to merge into the current branch. I would suggest this method only when you know one version is outdated or it is impossible to merge any other way (for example, Xcode Storyboard files cannot really be merged together) Screen Shot 2017-10-05 at 10.21.59 AM.png
  3. As you see above, when you right click a conflicting file in Source Tree, you can also choose to “Launch External Merge Tool.” This is built into Source Tree, but there are many other tools like it available, including ones which can be launched from the command line. The tools usually have two sides showing the different versions of the code and where the conflicts are. From there, you can choose to include the mine or theirs or both when committing the merge. Here’s what the Source Tree tool looks like on a test project:Screen Shot 2017-10-05 at 10.22.25 AM.png

Now you’re a Git expert!

2b4gjtf

(I mean, besides the fact that we haven’t even talked about forking, detached heads, pull requests, squashing, etc….)

Sources (besides experience):

Git Explained: For Beginners

Git Flow Explained: Quick and Simple

Understanding Git Conflict Markers

Additional Resources:

Atlassian’s Learn Git Tutorial

Git Commands GitHub Cheat Sheet

 

Advertisements
burning questions, research, thoughts

What happens to amputated limbs and similar disturbing questions

(OBLIGATORY TRIGGER WARNING AND AN APOLOGY OR TWO: This blog entry contains content that may disturb some readers, including but not limited to surgery and some violent imagery. I apologize if this bothers you and implore you to stop reading now and look at these puppies and kittens instead, unless baby animals also offend you, in which case go bang your head against a wall until that part of your brain gets jumbled back into place. If you or a loved one is an amputee, I apologize for my utter ignorance and possible insensitivity, I tried to be as clinical and factual as possible, but this is also an opinion piece above all else since it’s posted on a blog, not a medical journal. I hope anyone who is still reading, enjoys what I wrote and finds it interesting and informative. Hugs and kisses -Rachel)

 

Okay, so sometimes a question plagues my brain, and I don’t know where it comes from, but once it’s up there, it won’t fucking leave. So that being said, the question I had was: what happens to amputated limbs?

I think it may have started with my recent addiction to audiobooks because I’ve listened to Furiously Happy by Jenny Lawson like three times and in one chapter she described her experience with a fucked up gall bladder. She mentioned wanting to keep her gall stones to “make a necklace out of them,” but the doctor told her that regulations forbid it. But I seemed to remember William Shatner keeping and selling his kidney stone (which totally happened in 2006, when I was 11). He sold it for charity for $25,000, (who is in the market for celebrity kidney stones anyways?) but I’m getting ahead of myself. My base question before I started looking into it, was what happens to removed parts after surgery?

It had been bouncing around and around in my head, so I asked my best friend, Haleigh, who is studying pre med and works in a hospital as a scribe. According to her, things that are removed from the body are sent to pathology, then either incinerated or if the patient so desires, sent to their funeral home to be buried with them when they die.

So, that got me wondering, what if someone wanted to keep it? Like just keep it themselves, at their house, to do whatever with? Is that possible? Is that legal? What would they do with it? Taxidermy? Just a ton of new questions to plague my brain, so I did some research.

So, first, are you legally allowed to keep yours or any body parts? The answer is yes! According to this PBS article, “there is no U.S. federal law preventing the ownership of body parts, unless they’re Native American” (so then what if you’re an amputee Cherokee? Hmmm…). A few states, including Louisiana, Georgia, and Missouri, have some state laws restricting it, but in general it is not against the law in the United States.

Haleigh was completely correct, as usual, about what happens to removed body parts. Once something is removed from the body, it is sent to pathology for a number of reasons, one, to have samples taken for hospital records. Another reason is to verify the doctors were correct in their assessment of what was wrong and what was removed (if they are proven wrong what happens? Like “whoops, we accidentally removed the wrong organ, our bad, please don’t sue us?”) and another to test for pathogens. Removed body parts are then considered medical waste and usually incinerated. However, some people, because of religion or just preference, have their part sent to their funeral home so they can be buried as one whole person when they eventually bite the big one. For example, many Orthodox Jews believe they need to be buried wholly (Does that include foreskin? A question best left for another time.). There are also accounts in history of removed limbs being buried separately with their own little headstones and everything, the last half of this article documents some such cases.

Some hospitals though, have internal rules forbidding the return of body parts. Also, when pathology takes samples, the process can destroy whatever was removed. Even the surgery itself can damage it, especially with endoscopic surgery, where the organ or stone is removed in pieces without cutting open the patient (if you need more explanation, Google it or something, I’m not a doctor). Then, even if they aren’t damaged or destroyed, if they contain any dangerous pathogens or communicable diseases, they need to be destroyed or at the very least contained.

Haleigh asked a doctor while she was at work about it, and the answer she got corresponds with much of what I’ve read. Haleigh was told that a limb is too big to take home because you couldn’t preserve it in a jar or seal it off completely (implying that smaller remover body parts like a finger or an ear wouldn’t be a problem, right?) so it would get gross, decomposing or whatever. Also, breathing all the chemicals like formaldehyde would be unhealthy so that’s a moral no-no in the least for a hospital. It’s different than like a gallstone which would just be a gallstone regardless of where it was. Also, they are hesitant to give back organs so people can’t sell them on the black market. However, if you have a foreign body (like a screw or something) taken out that isn’t inherently “human tissue” you can get that back. Most of the time they say no to questions about keeping limbs unless it’s for religious or legal reasons (at least at the hospital where she works) because the paperwork is a pain in the ass, but not necessarily illegal.

But like I said, assuming someone could manage to take their bigger body part home with them, I got to wondering if some people just wanted to take their removed part home, just for fun or to use as a prosthetic or halloween decoration. I don’t know, would someone want to taxidermize their removed limb?

When I googled “amputated limb taxidermy” a result came up called “The 5 Most Disturbing Things Ever Done With Taxidermy” and even that list did not include anything human, which I know would surely be horrifying, but hey, I’m curious, and the question is stuck in my brain, man. Even if someone wanted to, say, taxidermize their leg, apparently it’s nigh impossible, since human skin, to put it gently, does not go through the process of tanning and all very well, according to Katie Innamorato, professionally trained, award-winning taxidermist in answer to this question on Hopes and Fears. There are a few examples like “El Negro” and English Philosopher Jeremy Bentham, which are the most famous cases of human taxidermy. Other than that, I didn’t find many examples of amputees wanting to do this exactly (though some did similar things, but we’ll get to that). I did find my same question on Yahoo Answers from 2010, which proves I’m not crazy (because people asking weird questions on Yahoo Answers are the epitome of very, very normal).

So, do people keep their amputated body parts? And what do they do with them? Fret not, I have done some research (Okay, so it’s nothing super academic, and I only have a few examples, but this isn’t a fucking term paper or something.).

I already mentioned, Shatner sold his kidney stone for charity. Jenny Lawson wanted to make gall stone jewelry. What about amputees? Who has been successful and how did they do it and what have they done with their limbs once they’ve brought them home?

One woman from Oklahoma was simply persistent and “told everyone involved in handling [her] leg to not throw it away.” After pathology studied her removed leg and took samples, they sent it back to her. She then sent it to Skulls Unlimited, a company that cleans skeletons, which defleshed it, whitened it, and attached all the bones together. So, now she has a part of her own skeleton, which I personally think is like the awesomest thing. You can read more about her here.

A man in the UK had his club foot removed and wanted simply to donate it to science, but was denied because it wasn’t “perfect.” After that, he decided to hold a charity fundraiser competition to have people guess the weight of it. Then, he had it cremated and spread the ashes himself. His story is in this article (the same one with all the foot graves).

A man from the Netherlands wanted to turn his amputated leg into a lamp a la A Christmas Story. He had trouble at first, but eventually got in contact with a pathologist who was willing to help safely preserve his leg in a large glass jar and return it to him. Then, a designer heard about his desire to make a lamp, and reached out to help. It’s very different from how he envisioned it, as the leg is in a jar surrounded by metal bars with the light atop it (think less A Christmas Story and more Frankenstein’s Laboratory). He planned to sell the lamp (for a whopping €100,000, ~$108,000) to pay for a prosthetic, but eBay took down his offer after just two days since they don’t allow the sale of body parts. As of this article in 2014, he kept the lamp in his home, waiting for the highest bidder to find him.

All this, somehow led me to another fucking question: if a person were to donate their body part or even their body after death to be eaten, could that be considered sort of vegan of sorts? I just mean because part of the moral dilemma of eating meat, for some people, I certainly can’t speak for all vegans or any really because I’m not one, but the moral dilemma as I see it is the fact that cows or chickens or whatever can’t consent to you eating them, we can’t communicate with them or anything (also, terrible living conditions, and chemicals, and a litany of other horrible things I’d rather not think about in the meat industry, perhaps another time). BUT, if I, having had my leg removed, said, “If you’d like to eat this, you can, I give you my consent,” then it’s free game (game? Get it?), right? As a note, I read somewhere that it is not illegal to eat human parts, namely your own, but in theory anyone’s so long as you have their permission, IF it is not medically/procedurally removed, e.g. in the hypothetical situation above, my leg was somehow accidentally taken off because I dropped a chainsaw on it or something (is that too graphic? Sorry). I seem to remember a news story of someone eating like their own big toe or something after it was accidentally removed, but when I started googling things like “person eats own body part after accidental removal,” the results got a little disturbing (yes more disturbing than this entire blog post, shut up).

Whew. You should know this is way more than I ever thought I’d write about this subject, and honestly I could probably go on, but I’ve been thinking about this and writing for about a month and a half and I should probably stop before one of my family members punches me for asking them for the fourth time what they would want to do with their limb if it had to be removed. So, I guess I’ll leave you with this, what would/did you want to happen to your removed body part (be it if you been shot or had your spleen removed or you arm or your toe or your leg)?

Linked Sources (in no particular order, ‘cause I’m lazy and most, if not all, of them are linked in my post anyway):

http://www.hopesandfears.com/hopes/now/question/215065-can-you-taxidermy-people

https://en.wikipedia.org/wiki/Negro_of_Banyoles

http://www.cultofweird.com/medical/jeremy-bentham-auto-icon/

http://www.amputeelawyer.com/2015/06/10/do-i-have-the-legal-right-to-keep-my-amputated-limb/

https://answers.yahoo.com/question/index?qid=20110417205801AAS03sr

http://www.slate.com/articles/news_and_politics/explainer/2006/01/how_much_for_that_kidney_stone.html

http://www.hopesandfears.com/hopes/now/question/168921-can-you-keep-a-removed-organ-where-does-it-go

(Also, my original draft referenced an article called “Woman Has Husband’s Penis Stuffed By Taxidermist After Untimely Death” but then, looking at it again, I realized it’s from one of those literal fake news sites, like the Onion, that are “for entertainment purposes only.” I was disappointed. Still a fun read though)