<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[David Fellows - Medium]]></title>
        <description><![CDATA[Optimist developer based in NYC - Medium]]></description>
        <link>https://medium.com/david-fellows?source=rss----79c187e33e0---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>David Fellows - Medium</title>
            <link>https://medium.com/david-fellows?source=rss----79c187e33e0---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 09:14:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/david-fellows" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Git branch and merge made easy]]></title>
            <link>https://medium.com/david-fellows/git-branch-and-merge-made-easy-ec6918469837?source=rss----79c187e33e0---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec6918469837</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[David Fellows]]></dc:creator>
            <pubDate>Thu, 03 Oct 2019 03:06:51 GMT</pubDate>
            <atom:updated>2019-10-03T03:18:35.790Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Git branch and merge</strong></h3><h3><em>Step by step instructions.</em></h3><ol><li><strong>Git branch yourbranchname </strong>#create your branch</li><li><strong>Git checkout yourbranchname #</strong>move to your branch</li><li>Make your changes!</li><li><strong>Git status </strong>#check your changes</li><li><strong>Git add * </strong>#stage your changes</li><li><strong>Git commit -m “your message here” </strong>#commit your changes</li><li><strong>Git checkout master </strong>#switch to master branch</li><li><strong>Git merge yourbranchname</strong></li><li><strong>Git push </strong>#push changes back to remote</li></ol><p><em>#Commands are bolded, comments designated by #. Find more detailed instructions with pictures below!</em></p><p>Git can be a frustrating topics for novice developers. After putting in the hard work to learn a language’s basics, you are finally ready to begin your first project (hopefully with other developers). Little did you know, you would spend most of you first day not dealing with code, but source control! I’ve been there and hopefully I can make this process a little easier for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/260/0*nZh9Cr4XwNB8efdI" /><figcaption>After a long day of merge errors</figcaption></figure><p>This post assumes you know why source control is crucial and that you have the knowledge to begin a repo or clone one down to your machine. If this sounds like a foreign language head to <a href="https://guides.github.com/">https://guides.github.com/</a> and check out their basic material. “Hello, World” is always good starting place.</p><p>My goal here is to layout a concise, step by step guide, to making your first Git branch and merging it back to the master branch. Basic instructions can be found above — below I will provide a more detailed breakdown with additional useful info.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*nS1D54jD5D2hVwm9.png" /><figcaption>Image from docs.microsoft.com</figcaption></figure><p>Why branch? Branching is a fundamental part of source control that allows us to create “sandboxes” to write and test our code. This is critical for working on a team project. Each member can create their own branch to work on features before merging together on a single master branch. The master branch is the single source of truth and contains only thoroughly tested, functional code.</p><p><strong>Step 1 — Git branch yourbranchname </strong>#create your branch</p><p>If you’re conceited like me, your branch was most likely named after yourself. However, convention says it should be indicative of the branches purpose, such as: feature, css, project a, etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*DUazPfJDiLxCMuVZKKXX8g.png" /><figcaption>Calling git branch without naming a branch will provide a list of all branches. The head or * will be adjacent to what branch you are currently in.</figcaption></figure><p><strong>Step 2 — Git checkout yourbranchname #</strong>move to your branch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/797/1*ZgPhtNQvctbaZTrmak_dqQ.png" /><figcaption>The head is now next the examplebranch, showing the move was successful.</figcaption></figure><p>Pro tip: commands in git can be streamlined using tags (shortened versions of other commands). See documentation for which tags can be used with each specific command. Step 1 and Step 2 can be combined by using the following: <strong>git checkout -b examplebranch</strong></p><p><strong>Step 3 — </strong>Make your changes!</p><p><strong>Step 4 — Git status </strong>#check your changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*Sqk3nAxB0tDh5KKsLdjtwg.png" /><figcaption>“git commit -a -m “your message here” will combine steps 5 and 6!!</figcaption></figure><p>Git status is an extremely helpful command which will show you the current state of your working directory and staging area. Files that have been modified but not added to the staging area will be listed in red.</p><p><strong>Step 5 — Git add * </strong>#stage your changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*Q1X7PNRrlVs6acBwT28U0Q.png" /></figure><p>Git add will add your file(s) to the staging here. This doesn’t save anything but lets git know what you would like to commit. * will add all changed files but is considered a bad practice. If you have changed multiple files you should add the exact files you want to save. Simply replace the * with a filename.</p><p><strong>Step 6 — Git commit -m “your message here” </strong>#commit your changes</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/1*TRnR8bv4bV0pRYQnJJJUgA.png" /></figure><p>Git commit will create save a snapshot of your current staging area. Committing often is an important aspect of source control. If something goes wrong you will be able to rollback your commits to code that previously worked. Keep commits short (between 2–20 lines). Each commit should have a message which sums up the changes made.</p><p><strong>WARNING: </strong>If a commit is made without a message you will most likely enter the VIM text editor. Commands here vary but hopefully you will be able to exit by hitting the escape keeping, typing q!, and then enter.</p><p><strong>Step 7— Git checkout master </strong>#switch to master branch</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*lzTkh0t-gpqys_oBuKi4UA.png" /><figcaption>Although git status shows there is nothing to commit, the master branch is not update to date with your examplebranch</figcaption></figure><p><strong>Step 8— Git merge yourbranchname</strong></p><p>Merging your branch into the master will overwrite your master branch with the changes you made in your new branch. At this time you may want to delete your other branch with the command “<strong>git branch -d</strong>”. Branches are typically removed after the updates are made.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*qFreomCqXn0Pc6Irj7wRBw.png" /></figure><p><strong>Step 9— Git push</strong></p><p>If you are making your first git push you will have to set your upstream. Follow the prompt in the command line.</p><p><strong>WARNING:</strong> Git push will “push” your changes up to the remote (online) branch. Be sure sure your code is working properly. At this point, your coworkers will be able to “git pull” these changes down to their local files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*BA35y09Y2snx68_r.gif" /></figure><p>Congratulations!! You have made your first (hopefully successful) branch and merge!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec6918469837" width="1" height="1" alt=""><hr><p><a href="https://medium.com/david-fellows/git-branch-and-merge-made-easy-ec6918469837">Git branch and merge made easy</a> was originally published in <a href="https://medium.com/david-fellows">David Fellows</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>