Blog

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
beauty

bareMinerals BarePRO Foundation

I received bareMinerals BarePRO Foundation free for testing from Influenster in exchange for honest reviews online. If you’d like to join Influenster, please use my referral link.

 

I got this product about a month ago and have put it through multiple tests so I like to think I’ve got a good idea of how well it works:

Pros:

  • Color match is great for me and the overall range is pretty large with 30 shades
  • Medium coverage (It’s listed as full though…)
  • Lightweight and feels good on
  • Awesome packaging! Bottle is thick and luxurious, pump works well AND LOCKS, it’s all simple and sleek
  • Relatively long lasting — for the most part

Cons:

  • Difficult to blend and NOT buildable! If you want to build coverage, use a different foundation because this one just picks product up and gets patchy
    • And forget about making it have more coverage by using a sponge, that produces the same result
  • Not ideal for oily skin, but not the worst
    • Rubs off of my nose (but I’m oily and I wear glasses so…)

The way I’ve gotten this to work for me is by mixing in Urban Decay’s Velvetizer. This makes it have a little more coverage, be more blendable, and last a little longer (especially on my nose). However, I have to use more product for each application and it takes more time.

Overall, I probably wouldn’t recommend this product and won’t use it on a daily basis, but it’s not the worst I’ve ever tried.

anxiety, real life, Self improvement

Falling off the bandwagon in more ways than one

First, my presence on social media. My favorite social site is Instagram by far, I have two accounts (@racheltheharvey and @rachelswatches 😉) and I really do like uploading pictures with what I’m doing or what I think, and even plan posts in advance. But I haven’t been doing as much of that lately. Partly because my phone is at memory capacity, partly because I’ve been so busy lately. That’s why I haven’t been blogging as much in the past month or so, too. 

I just started my senior year of college and I seriously just wish I was already graduated. 

My summer ended nicely, I got fairly positive feedback from my internship and even interviewed for a real life, adult job before school started. 

My morale took a big hit though because of a decision made by my boss and the staff at my college job; they decided to demote me. No one can deny that I had a rough semester last spring, but this is a job I’m seriously passionate about and which I put maximum effort into as I struggled through grief, depression, and anxiety, things that are still affecting me today. I lost friends because all my effort was going into my job and my schoolwork, and I felt unappreciated and unnoticed by my superiors. I guess this proves me right, but I don’t want to go on too long and sound defensive or rude, but this has really caused me a lot of stress, anger, and most of all sadness. The only thing I can do now though is prove them wrong and earn a re-promotion. 

Sometimes I just feel like nothing is worth the effort though. I feel like I’ve lost the drive and motivation that has helped me excel academically and professionally in the past. 

In case you’re wondering, I have made an appointment with a counselor to talk about the anxiety and panic attacks I experienced this summer as well as my feelings and problems now. 

Another cause of stress and insecurity has been my recent weight gain, in the last year and a half or so I’ve gain upwards of 60 pounds I don’t need. I am a big comfort eater and not a big vegetable fan, a dangerous combination. So today was my first workout day. I started small, but I started and that can be the hardest part, so I’m hopeful. 

I’m also working on saving money. As well as being an emotional eater, I go in and out of retail therapy, especially since I’ve started loving and honestly collecting makeup. But I’ve cut back and I’m working to keep saving more than I’m spending. 

So, if you’ve made it this far, thank you  as you can see, I’ve got a lot of self improvement to do, but I’m determined to become a healthier me in every aspect. 

real life

Something that makes me happy

Exploring with my best friend for my birthday weekend last week:

A sleeping Red Panda at the Indianapolis Zoo. 


Sushi at Mikado not far from the Circle in downtown Indy. We were the only ones there! It wasn’t our favorite sushi, but good and good quality. 


We went to Funky Bones, which I’d never seen before, but was awesome!

We also went to an ice cream place called Lick, which was a strange experience to say the least. First, we got to the address and didn’t see anything but warehouse-like buildings. So, we called the listed number and they told us there was a sign out front, we had to drive around the block again but finally saw the tiny sign poking out in front of a little art shop. We walked into the art store and asked the person working who directed us down a hallway. It had a really school-in-the-summer type vibe, in that it was totally deserted with linoleum flooring, cream walls, and tube lights. At the end of a hallway and around a corner, we finally found it. Just one small room with a kitchen visible in the back. The decor was cool, a counter with vintage ice cream scoops stood in one corner and the wall had posters depicting the same. In the other corner was a small cart with four or five flavors of ice cream in it. The only person working was one of the two sisters who share the business. No one else was in sight. Just as we were thinking, this is odd, the lights flickered and the lady working went, “oh, hmm.” And then she murdered us. 

But not really, obviously, she was just a chill lady who was passionate about ice cream. We got a sweet corn cookie sandwich with salted caramel ice cream. And it was actually really good! 

That was a long tangent on ice cream; it was certainly a memorable experience. 


It was a really good day. 

recipes

Cheese & Spinach Stuffed, Bacon Wrapped, Baked Chicken

Ingredients:

  • ~2 lb. thin cut chicken
  • 1/2 lb. bacon
  • Fresh mozzarella
  • Spinach
  • Salt, Pepper, Italian Seasoning

Directions:

  1. Preheat oven to 375ºF and line baking sheet with tin foil
  2. Take a piece of chicken and sprinkle with and rub seasonings into it. Place some spinach and a slice of cheese on one end and roll the chicken up around it.
  3. Wrap a strip of bacon around the rolled chicken, going the opposite direction.
  4. (Optional) Sit another slice of cheese on top the wrapped chicken and sprinkle with seasoning. Cut a strip of bacon in half and lay both over the top perpendicular to one another. My pieces had trouble staying together with this on top, but it was still really good 🙂
  5. Bake 25-30 minutes. Broil for 2-3 minutes.

I prepped this, wrapping each piece in parchment paper before placing them in a container and freezing them. Then I thawed them for a day before baking!