<?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[Stories by Igor Marques da Silva on Medium]]></title>
        <description><![CDATA[Stories by Igor Marques da Silva on Medium]]></description>
        <link>https://medium.com/@igor_marques?source=rss-b0f7d6f2f5e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HC7V_zAWXo-jxd6LrCfxXw.png</url>
            <title>Stories by Igor Marques da Silva on Medium</title>
            <link>https://medium.com/@igor_marques?source=rss-b0f7d6f2f5e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 19 May 2026 06:57:01 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@igor_marques/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[How to find an iPhone's UDID]]></title>
            <link>https://medium.com/@igor_marques/how-to-find-an-iphones-udid-2d157f1cf2b9?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d157f1cf2b9</guid>
            <category><![CDATA[finder]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[iphone]]></category>
            <category><![CDATA[macos]]></category>
            <category><![CDATA[udid]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Wed, 16 Sep 2020 14:57:32 GMT</pubDate>
            <atom:updated>2022-12-23T12:08:23.565Z</atom:updated>
            <content:encoded><![CDATA[<p>This tutorial will show a simple way to find this information without any app, certificate installs nor iTunes.</p><p>This tutorial requires only a macOS device, the iPhone and the phone&#39;s power cord. If you have the iPhone <a href="https://support.apple.com/guide/mac-help/wi-fi-syncing-mchlada1d602/mac">paired to the macOS device through wi-fi</a>, you don&#39;t need a power cord and can skip steps 1 and 2. This tutorial was based on macOS Ventura and it applies on older versions of macOS as well.</p><h4>Steps</h4><ol><li>Connect the iPhone to an USB port of your macOS device.</li><li>If the iPhone asks for permission to trust the macOS device, grant it (assuming it&#39;s a device you trust).</li><li>Open the Finder app.</li><li>Go to the iPhone in the Locations section of the sidebar. It should open the device&#39;s page.</li><li>Click on the info section bellow the iPhone name on the top of the page until it displays the UDID.</li></ol><figure><img alt="The iPhone&#39;s page on Finder with an arrow pointing to the section where the UDID is." src="https://cdn-images-1.medium.com/max/972/1*k5-n5_OtaDst3skVPxwY3A.png" /><figcaption>The iPhone’s page on Finder with an arrow pointing to the section where the UDID is.</figcaption></figure><p>You can copy the UDID by right clicking on it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d157f1cf2b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Basics: Rewriting a branch's commit history from scratch]]></title>
            <link>https://medium.com/magnetis-backstage/git-basics-rewriting-a-branchs-commit-history-from-scratch-7bc966716d8b?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/7bc966716d8b</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Tue, 23 Oct 2018 16:40:33 GMT</pubDate>
            <atom:updated>2018-10-23T16:40:33.200Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kpsYGDmZ2uNnbvXqBJWwIQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/H7LxvEmVZnE?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Zach Reiner</a> on <a href="https://unsplash.com/search/photos/branch?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>With this post you&#39;ll learn how to rewrite the whole history of a branch. In other words: undoing all commits but keeping their changes to be committed again.</p><p>Let&#39;s say you have four commits:</p><pre>f7f3f6d Create FileA<br>310154e Update FileA with x<br>a5f4a0d Create FileB<br>421265e Update files A and B with Y and Z</pre><p>But you want to rewrite the whole history to have just two:</p><pre>Create file A with X and Y<br>Create file B with Z</pre><p>Sure you can manipulate the tree of changes with the git rebase -i command (<a href="https://git-scm.com/docs/git-rebase#git-rebase--i">reference</a>), but there is a more straightforward way of rewriting a branch: with git reset --soft .</p><p>Let&#39;s see how to use this command.</p><h4>Doing a Soft Reset</h4><p>Assuming you&#39;re branch was created from a branch named <em>master</em>, just run (running a git fetch originfirst is recommended):</p><pre>$ git reset --soft origin/master</pre><p>Now you&#39;re going to have all of your commits undone, but their changes will be kept as <em>added</em> to your stash. You can also use HEAD~4 instead of origin/master to undo the last four commits, for example.</p><p>So, running a git status should return something like</p><pre>$ git status</pre><pre>On branch your_branch_name</pre><pre>Your branch is ahead of ‘origin/your_branch_name’ by X commits.</pre><pre>  (use “git push” to publish your local commits)</pre><pre>Changes to be committed:</pre><pre>  (use “git reset HEAD &lt;file&gt;…” to unstage)</pre><pre>modified: FileA<br>modified: FileB</pre><p>Again, you can see that both FileA and FileB are added, but not commited. You can undo this by running git reset HEAD . (your changes will remain, don&#39;t worry).</p><p>Now you&#39;re free to rewrite your commit history as you want!</p><p>Disclaimer: if you already have pushed your changes to a remote repository, you&#39;re going to use git push --force to send the new changes to the repository. Proceed with caution!</p><p>You can check more posts about Git Basics below:</p><ul><li><a href="https://medium.com/@igor_marques/combining-two-commits-84281f470ee8">Git Basics: Combining two (or more) commits into just one</a></li><li><a href="https://medium.com/@igor_marques/git-basics-adding-more-changes-to-your-last-commit-1629344cb9a8">Git Basics: Adding more changes to your last commit</a></li><li><a href="https://medium.com/@igor_marques/git-workflow-basics-d405746f6205">Git Workflow Basics</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7bc966716d8b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/magnetis-backstage/git-basics-rewriting-a-branchs-commit-history-from-scratch-7bc966716d8b">Git Basics: Rewriting a branch&#39;s commit history from scratch</a> was originally published in <a href="https://medium.com/magnetis-backstage">magnetis backstage</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remote Work: Introduction and Tips]]></title>
            <link>https://medium.com/magnetis-backstage/remote-work-c70021b5d7c6?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c70021b5d7c6</guid>
            <category><![CDATA[remote-work]]></category>
            <category><![CDATA[remote-working]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Mon, 11 Sep 2017 13:53:18 GMT</pubDate>
            <atom:updated>2018-08-13T22:13:21.608Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rt6LGTftB0SEDAYJbiSOWg.jpeg" /><figcaption>Credits: <a href="https://unsplash.com/photos/gxD8hCmi0IQ?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Parker Byrd</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Many companies around the globe are hiring remotely and this number is <a href="https://www.nytimes.com/2017/02/15/us/remote-workers-work-from-home.html">only increasing</a>. A remote worker is an employee who does not need to commute to an office or any kind of central place of work.</p><p>I currently work at <a href="https://magnetis.com.br">Magnetis Investments</a>, on a team with around ten software developers. Most of them, as me, are fully remote and we live in states other than the one from our company’s headquarters.</p><p>As a remote web developer, I&#39;m writing this post with a small introduction and some useful tips for those who are considering this alternative. This post is also for those who already are remote workers and seek for improvement in their routine or practices. Even though we&#39;re a team of developers, most of the concepts and tips bellow can work for any area.</p><p>Let&#39;s start with…</p><h3>Some Pros and Cons</h3><p>First of all, what do you have to keep in mind when considering going remote. There are way more topics on each subject and each person may consider different things as pros and cons.</p><h4>Pros</h4><p>One of the main advantages for working remotely is the lack of commuting. Spending a couple of hours daily on traffic can be a pain in the ass for most people.</p><p>The lack of geographical barriers also enables companies to hire good employees wherever they want.</p><p>The other way around is also totally true. Even if you don&#39;t live in a tech hub, you&#39;ll still be able to find a good job somewhere else without moving.</p><h4>Cons</h4><p>It demands more organization from both the company and the employees. People will have to take care of themselves and be trusted with this kind of responsibility.</p><p>Loneliness may also be a problem for some people and must be addressed by managers with some practices I&#39;ll describe in this post ;)</p><p>Productivity can also be another problem. Some people can underperform due the lack of &quot;supervision&quot; while other can work way too much which can lead to <a href="https://en.wikipedia.org/wiki/Occupational_burnout">burnout</a> in the future.</p><h4>&quot;Remote work isn&#39;t for me&quot;</h4><p>Well, maybe it isn&#39;t and there&#39;s nothing wrong with it :)</p><p>But keep in mind that a whole lot of people already does remote work but does not realize it. <a href="https://en.wikipedia.org/wiki/Outsourcing">Outsourcing</a> workers mostly do their jobs as remote workers for other companies. One of my previous jobs was as a outsource developer. Even though I was located in Brazil, my client&#39;s team was located both in other cities from Brazil as even in the USA (in a different time zone). To them, I was a remote worker.</p><p>But again: it&#39;s totally OK to not be interested in doing remote work.</p><h3>What do you Have to Keep in Mind When Working Remotely</h3><p>Since your team will be distributed (some times even across different time zones), most of your communication will be done through writing. Being clear and concise is essential. Online text chats like Slack and Hipchat will sometimes be your main work tool.</p><p>But keep in mind that just text can&#39;t solve all of our communication problems. People have different schedules and have to work their own demands. Don&#39;t expect everyone to be available all the time and try not to break someone&#39;s <a href="https://en.wikipedia.org/wiki/Flow_%28psychology%29">flow</a> (which in a nutshell can be described as the mental state that people achieve when they&#39;re fully immersed in what they are doing).</p><p>Here are some tips on how both a team and an individual can be remote friendly.</p><h3>What a Team Can do to be Remote Friendly</h3><p>Again, the main goal here is to avoid wasting people&#39;s time. Most of the following tips aim to achieve that.</p><h4>Documentation and Phase In</h4><p>To achieve that, your team can start by having processes and any other type of flow &quot;documented&quot;. This can make the phase in / on boarding of newcomers very easy while preventing someone to have to spend some time on repetitive tasks over and over again. A list of software used by your team, and the reasons behind, as well as a list of obligatory appointments everyone must attend is a good start.</p><p>But be careful to not end up with a team too &quot;cold&quot; on newcomers. It&#39;s always a nice thing to spend some time and talk with them, specially if this is their first experience being remote. It must be clear to them that your team is open to answer any questions they may have.</p><h4>Some Notifications are Welcome</h4><p>As I mentioned, remote workers spend most a good chunk of their day on text chats. For some teams, it may be useful to have some automatic notifications on, to prevent people from having to do the same thing twice (doing the action AND notifying about it). For software developers, for example, it&#39;s useful to have a notification every time a new release is made available to their users of if someone found out a critical issue in their code.</p><p>You only have to be careful to not flood everyone with each and every type of notification possible. Too much noise can prevent people from focusing or even to paying attention to notifications at all, which can lead too important stuff to going unnoticed.</p><h4>Make a Good Use of your Means of Communication</h4><p>Sometimes, only text chats aren&#39;t enough. More detailed explanations or long discussions can often be done way more efficiently on online calls in services such as Google Hangouts, Skype and others (Slack, for instance now has this feature built in).</p><p>Other important topic on this matter is always try to involve in a conversation the least amount of people needed. If the subject is not from the interest of someone, they should not be involved. Again, this is to prevent people from going out of their &quot;flow&quot;.</p><p>I have a <a href="https://medium.com/@igor_marques/good-communication-in-software-development-teams-7a05d94106f6">whole post about means of communication</a>, so take a look if you&#39;re interested.</p><h4>Some Meetings are Okay</h4><p>Having a short daily meeting to where people describe what they have worked on the previous day is a good way of achieving two good things:</p><p>1- Keep everyone on the team on the same page</p><p>2- Increase the notion of team</p><p>Make sure that those meetings are <strong>short</strong> and in a good time for everyone. In the middle of the morning or the afternoon are not usually good times for meetings since they can break people&#39;s concentration during an important task.</p><h4>Screenshare and Pair Programming</h4><p>This is a practice where usually two developers work together to solve a problem. Remotely, it can be done through screensharing tools, which allow your &quot;pair&quot; to see and sometimes even interact with your desktop while having a voice chat at the same time.</p><p>It&#39;s an excellent practice to promote knowledge sharing and reducing the feeling of loneliness.</p><p>Some chat clients like Slack have a built-in screenshare tool. Google hangouts also has this feature (even though it takes much more of your CPU). <a href="https://screenhero.com">Screenhero</a> is another great alternative and personally my favorite (but at the time I&#39;m writing this, it&#39;s only accepting new users by invitation of current users).</p><p>When screensharing, one good thing to do is to disable notifications to keep up your privacy. Apps like <a href="https://muzzleapp.com">Muzzle</a> for macOS (their site is just great) can automaticaly disable notifications when a screenshare tool is on. Using different a different desktop area for work can also help.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*ACGyEz-_aKBrIjY_uUfV8g.png" /><figcaption>At left, personal stuff. At right, work :)</figcaption></figure><p>But be careful: too much pair programming (like any other type of meeting, actually), can be very tiresome. Ensure that people have time to rest between work sessions. Some people like to use the <a href="https://en.wikipedia.org/wiki/Pomodoro_Technique">Pomodoro Technique</a> or other variations on it.</p><h4>Don&#39;t Go Full BIG BROTHER on Your Team</h4><p>Some companies that allow remote work do that under very strict conditions. They require their employees to install software to monitor stuff like keyboard activity, webcam and microphone, OS processes and others to ensure that their employees were being &quot;productive&quot;. Time spent away from the computer (like bathroom breaks) are discounted from the employees paycheck.</p><p>I should not have to say that it’s very stressful to work under strict vigilance.</p><p>If you&#39;re a manager and you&#39;re trying to implement remote work for your team, keep in mind that tools like that are not well-seen by many. Trust your teammates and avoid this kind of stuff at all costs.</p><p>And if you&#39;re looking for a remote job opportunity, be sure to know if the companies you&#39;re applying to implement these types of policies.</p><p>And now, some tips for individuals on a remote team.</p><h3>What You Can do to be Remote Friendly</h3><p>Here the goal is to keep everyone aware of what you&#39;re doing.</p><p>Make clear to everyone whether you&#39;re available for chatting / questions or not. Slack, for instance, has a great <em>status</em> feature where you can easily describe what you&#39;re doing in the moment. But just to be clear, try not to annoy anyone in the process. Not everyone needs to know RIGHT ON THE SPOT that you&#39;re having lunch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*Q2QdWaYEbAb_RMeEzbOcQg.png" /><figcaption>Slack&#39;s <em>status feature</em></figcaption></figure><p>Having a routine can also help your teammates to be aware that they can or can&#39;t count on you for something in the moment.</p><p>With that in mind, remember that people have their work to do an they usually can&#39;t reply instantaneously.</p><p>Also, giving as much details as possible is always a nice thing to have. It&#39;ll prevent your teammates to have to ask you from something that was not clear and enable them to work more independently (if they work on a different time schedule than you, for example). Writing more, providing links, examples and related information will take you a little more time, but can prevent much more time waste in the future.</p><h4>Take Care of Your Health</h4><p>As I mentioned earlier, home office can be very tricky in terms of productivity.</p><p>Be sure to have a clear division between work and free time. When your workday is over, closing your chats, email client and any other thing that reminds you of work can help with this. Some may take this to a next level having an specific spot in their house just for working. Having different desktop areas can also help.</p><p>Snoozing notifications is also a great thing to do. It&#39;s hard to forget about work when you&#39;re constantly being reminded that something is happening there.</p><p>This is the type of issue that can, with time, lead to burnout and sometimes leave serious scars on one&#39;s mental health. But hey, this is something that already happens even with non-remote workers!</p><h3>TL;DR</h3><ul><li>Remote work can be a good opportunity if one can&#39;t stand commuting or the place you live doesn&#39;t match your career goals</li><li>But has its challenges, specially regarding organization and trust</li><li>A team has to make good use of the means of communication available, always allowing people to have time to do their work uninterrupted</li><li>An individual must keep people aware of what they&#39;re doing and remember that their teammates also have work do it</li><li>And always remember to keep work and free time very apart.</li></ul><p>Not all of those tips may work for you or your team, and that&#39;s just fine. Everyone has a different workflow, after all.</p><p>If you&#39;re interested in more tips about remote work, this <a href="https://www.youtube.com/watch?v=83fk3RT8318&amp;feature=youtu.be&amp;app=desktop">short video from Mozilla</a> and the book <a href="https://37signals.com/remote">Remote: Office Not Required</a> and can be a good start.</p><p>And if you have any other tips or questions, be sure to leave them in the comments :)</p><p>Thanks for the reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c70021b5d7c6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/magnetis-backstage/remote-work-c70021b5d7c6">Remote Work: Introduction and Tips</a> was originally published in <a href="https://medium.com/magnetis-backstage">magnetis backstage</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conhecimentos que Todo Desenvolvedor Iniciante Precisa ter (Parte 2)]]></title>
            <link>https://medium.com/@igor_marques/conhecimentos-que-todo-desenvolvedor-iniciante-precisa-ter-parte-2-fbeb69b23a3f?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbeb69b23a3f</guid>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[carreira]]></category>
            <category><![CDATA[software]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Thu, 05 Jan 2017 13:13:28 GMT</pubDate>
            <atom:updated>2017-01-05T13:13:28.890Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*36GUpmSoBqqXWiSbOuwdTA.jpeg" /><figcaption>fonte <a href="https://www.pexels.com/photo/apple-desk-laptop-macbook-pro-5363/">https://www.pexels.com/photo/apple-desk-laptop-macbook-pro-5363/</a></figcaption></figure><p>Como o próprio título diz, esse post é uma continuação <a href="https://blog.codeminer42.com/conhecimentos-que-todo-desenvolvedor-iniciante-deve-ter-e-onde-obtê-los-2016-b41dd4281fd4#.gftqwgbcc">desse outro</a>. Agora vamos falar um pouco sobre alguns conhecimentos mais avançados que são um diferencial no momento de uma contratação.</p><p>A intenção aqui é estimular uma pesquisa mais avançada sobre cada um dos tópicos. Definir tudo em detalhes aqui deixaria esse texto muito longo.</p><p>Vamos lá!</p><h3>Testes Automatizados</h3><blockquote>— Como você sabe que o seu código tá funcionando?</blockquote><blockquote>— Eu rodo e testo</blockquote><blockquote>— Beleza, mas e quando você faz uma funcionalidade nova?</blockquote><blockquote>— Testo ela e as funcionalidades anteriores.</blockquote><blockquote>— Mas e se você tiver 100 funcionalidades?</blockquote><blockquote>— Aí complica um pouco, né?</blockquote><p>De fato, complica mesmo.</p><p>Todas as linguagens de programação comerciais atuais possuem algum framework de testes automatizados. Esses testes podem ser rodados com um simples comando e realizam uma série de procedimentos e checagens (definidos pelo desenvolvedor) de maneira autônoma, podendo até mesmo simular as ações do usuário navegador, por exemplo.</p><p>Testes automatizados te dão uma segurança maior no seu código e, principalmente, que ele não quebra o que já estava pronto antes. Para grandes aplicações, é praticamente inviável realizar um checkup manual completo em todas as funcionalidades antes do lançamento de uma nova versão para o cliente.</p><p>Ter conhecimento sobre os conceitos de testes unitários e de testes de integração também é fundamental. <a href="http://stackoverflow.com/a/5357837/1572882">Essa resposta no Stack Overflow</a> dá uma boa definição.</p><p>Para cada linguagem/framework geralmente existe mais de um framework de testes. Procure um pouco sobre cada um e estude aquele que mais se adequa ao seu gosto e necessidades :)</p><h3>O Básico de REST</h3><p>REST é um &quot;estilo arquitetural&quot; usado para comunicação entre aplicações na web. O conceito é bem mais denso que isso, mas o suficiente para você se virar gira em torno de conhecer e saber usar corretamente as operações que envolvem os verbos HTTP: GET, POST, PUT/PATCH e DELETE.</p><p>Quando você acessa uma página de qualquer site, seu navegador por padrão envia uma requisição contendo um desses verbos (e somente um por vez).</p><p>Por exemplo, ao simplesmente acessar <a href="http://www.google.com.br,">www.google.com.br,</a> seu browser manda para esse endereço algo como &quot;ei, me manda essa página aê&quot;. Ele quer receber algo, logo, o verbo enviado é um GET (como a tradução sugere).</p><p>Agora para casos em que você submete uma informação nova (como um formulário de cadastro, um novo status no facebook ou algo do tipo), seu navegador envia uma requisição contendo o verbo POST.</p><p>Já em casos onde você atualiza um recurso já existente (como, por exemplo, uma redefinição de senha ou alteração de dados cadastrais), o verbo PUT (ou PATCH) é enviado.</p><p>A diferença entre os dois verbos é que PUT envia todas as informações sobre o recurso que está sendo atualizado (no exemplo da redefinição de senha, seria enviada tanto a senha quanto os demais dados do usuário, mesmo não sendo necessários para essa mudança), enquanto PATCH envia somente a informação atualizada (ou seja, somente a senha no caso do exemplo). Em geral cada framework para web utiliza um desses verbos por padrão, então fique de olho.</p><p>E o caso do HTTP DELETE, como o nome sugere, é utilizado em casos onde um recurso está sendo excluído de uma aplicação.</p><h4>&quot;Tá, mas pra que eu preciso saber disso?&quot;</h4><p>Ao desenvolver uma aplicação web, você vai ter que se atentar a fazer com que seu código siga esse estilo arquitetural de maneira correta. Ou seja, não inventar de usar o verbo DELETE pra designar a ação de atualizar um recurso, por exemplo.</p><p>Um caso muito frequente é de aplicações que usam POST erroneamente para todas as ações. Você já deve ter notado isso em páginas que toda vez que você dá um <em>refresh</em> ou então um <em>voltar</em>, seu navegador pergunta: <em>&quot;Você deseja enviar seu formulário novamente?&quot;. </em>E nessas horas você pensa: <em>&quot;Mas peraí, eu não enviei formulário nenhum…&quot;</em>. Pois é, você acha que não enviou, mas foi o que o seu navegador fez por debaixo dos panos pra gambiarra contida na página funcionar.</p><p>Sendo assim, faça sua aplicação manter um comportamento que faça sentido semanticamente com relação aos verbos HTTP.</p><h3>O Básico de Organização de Código</h3><p>Se você está usando um framework para desenvolver sua aplicação, terá que seguir um mínimo esquema de organização/padrão estabelecido por ele.</p><p>A maioria dos frameworks web, por exemplo, segue o padrão de projeto <a href="https://en.wikipedia.org/wiki/Model–view–controller">MVC</a> (Model-View-Controller). Ele por exemplo estabelece que sua aplicação possui componentes para acesso de dados (Models), para a apresentação de informação (Views) e para a manipulação de requisições e retorno ao usuário (Controllers).</p><p>Dito isso, note que não faz sentido usarmos um componente de View para acessar o banco de dados da sua aplicação diretamente. Ou que um Model retorne HTML, por exemplo. Para quem está começando, essas razões podem não ser tão claras, mas como esse não é o objetivo do post, deixo essa parte como &quot;tarefa de casa&quot; :P</p><p>Vale lembrar que para cada padrão/modelo arquitetural diferente, existem diferentes formas de organizar o código da sua aplicação e responsabilidades. Dessa forma, sempre se pergunte se aquilo que você está implementando no momento <em>realmente</em> deve estar ali e procure referências na web com as melhores práticas para o framework de sua escolha.</p><h3>Formatos de Troca de Mensagem entre Aplicações</h3><p>É muito provável que você em algum momento da sua carreira tenha que desenvolver alguma integração entre sua aplicação e uma externa, ou até mesmo entre duas aplicações de sua própria autoria (exemplo: um aplicativo mobile e um servidor seu).</p><p>Atualmente a maior parte das aplicações utiliza o formato JSON para essa tarefa. Antes, XML era o formato mais adotado. Essa padronização é independente de tecnologia, permitindo que aplicações implementadas em linguagens ou frameworks completamente distintos possam trocar grandes volumes de informação através de um &quot;idioma comum&quot;.</p><p>Para entender um pouco sobre JSON, recomendo a leitura <a href="http://jsonapi.org">dessa documentação</a> sobre como sua API deve responder a chamadas desse tipo. Certamente a linguagem de programação de sua preferência possui alguma biblioteca que implementa o formato.</p><p>Lembre-se de sempre se aprofundar nos assuntos que foram mencionados aqui, sempre colocando em prática cada aprendizado sejam em projetos pessoais ou de algum emprego/estágio/bolsa :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbeb69b23a3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Ways to Improve your Health Endpoints]]></title>
            <link>https://medium.com/@igor_marques/improve-health-endpoints-16bf1132a9d3?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/16bf1132a9d3</guid>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Tue, 20 Dec 2016 18:42:56 GMT</pubDate>
            <atom:updated>2016-12-21T13:01:11.447Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of our applications today have a pretty simple health endpoint:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7e45b9e9362ef4136068118fcc715ba/href">https://medium.com/media/f7e45b9e9362ef4136068118fcc715ba/href</a></iframe><p>That actually just tell if your app is running or not. But imagine your databases connections are in a bad shape… This route may not even be affected by it and it will provide you a false positive.</p><p>This post describes some tips on how to improve your health endpoints, regardless the language/framework you use.</p><h3>Return a JSON with your health data</h3><p>Only sending a &#39;ok&#39; or &#39;not ok&#39; may not be totally useful for whoever consumes your endpoint. Instead, you can return a JSON with every status of the checks you do, being more precise on what&#39;s going on with your app.</p><p>Assuming you&#39;ll do the checks mentioned in this post, this can be an example of the response of your endpoint:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da5404e486f45ac520ba6857ad6221ce/href">https://medium.com/media/da5404e486f45ac520ba6857ad6221ce/href</a></iframe><p>Also, remember to properly set the HTTP status of the response to match your application status (200 when everything is ok and a 503 when things are in a bad shape).</p><h3>Check your DB connections</h3><p>Whether you use PostgreSQL, MongoDB or any other database, one important thing to check is if your DB is alive and well or if your connections are getting a timeout.</p><p>MongoDB, for instance, has a <a href="https://docs.mongodb.com/v3.2/reference/command/ping/"><strong><em>ping</em> </strong>command</a> that is able to check if your connection is alive. Remember to wrap this call in a timeout block like this example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/eb6d08e5c93edc65bbe509ddbaac230b/href">https://medium.com/media/eb6d08e5c93edc65bbe509ddbaac230b/href</a></iframe><p>With this check, you can ensure your DB is responding in time.</p><p><strong>EDIT 12/20/2016:</strong></p><p>As <a href="https://medium.com/u/4306dc96d262">Marco Singer</a> pointed in the comments:</p><blockquote>Since you’re calling the databases in this health endpoint I would like to suggest to use a rate limit on it or, at very least, make this endpoint availiable just for internal apps since you’re openning a door for external callers put your system down calling this endpoint several times.</blockquote><p>Please be very careful to who you’ll be exposing those endpoints or remember to use a good strategy to prevent attacks to your DB.</p><p><strong>END OF EDIT 12/20/2016</strong></p><h3>Check your Redis connection</h3><p>This is extremely important if you use any background job processing tool like <a href="https://github.com/mperham/sidekiq">Sidekiq</a>, which uses Redis to manage its data.</p><p>Redis has the same <a href="https://redis.io/commands/ping">ping command</a> I mentioned for MongoDB, but in this case it returns the string &quot;<strong><em>PONG&quot;</em></strong>.</p><p>With this you&#39;ll be able to make sure your app is ready to process your background jobs.</p><p>And about it…</p><h3>Check the latency of the queues of your background jobs</h3><p>This check can provide you an insight of your workers: if you have jobs getting stuck for some unusual and bizarre reason.</p><p>The mentioned Sidekiq offers you <a href="https://github.com/mperham/sidekiq/wiki/API#queue">some very handy methods</a> for checking the latency of any queue:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3a89903259665f684b1cd50f929b625b/href">https://medium.com/media/3a89903259665f684b1cd50f929b625b/href</a></iframe><p>Which can be included in the response of your endpoint:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08f0fd38d83d3b4a97718243659c94f2/href">https://medium.com/media/08f0fd38d83d3b4a97718243659c94f2/href</a></iframe><p>What about <em>your</em> health endpoint? What do you check? Leave a comment :)</p><blockquote>If you are interested in more posts about monitoring, you can <a href="https://blog.codeminer42.com/monitoring-your-apps-health-with-sickbay-and-the-nurse-e7255234dbcf#.i4c8tlwle">check this post</a> about two simple monitoring tools for your app.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16bf1132a9d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring Your App's Health with Sickbay and The Nurse]]></title>
            <link>https://medium.com/@igor_marques/monitoring-your-apps-health-with-sickbay-and-the-nurse-e7255234dbcf?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7255234dbcf</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[heroku]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[sinatra]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Mon, 05 Dec 2016 12:29:56 GMT</pubDate>
            <atom:updated>2016-12-21T12:32:55.924Z</atom:updated>
            <content:encoded><![CDATA[<h4>This post will guide you through setting up this simple health monitoring system</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qAgoipIYvPd03wt2EmzF5w.jpeg" /><figcaption>source <a href="https://www.flickr.com/photos/brykmantra/76765412">https://www.flickr.com/photos/brykmantra/76765412</a></figcaption></figure><p>With this simple Ruby stack, you&#39;ll be able to get live alerts whenever your apps (or the services you depend upon) are in a bad shape.</p><p>This stack can be used for example to trigger a Kill Switch mechanism in your app: When your app receives the The Nurse&#39;s request into some endpoint, it stops some critical/automatic procedure to keep going.</p><p>This can be extremely useful when dealing with a microservice architecture or when you app depends on external services.</p><p>This stack can be also be used as a way to keep tracking of your apps outages (it saves every one it registers).</p><p>It can easily be deployed in Heroku with almost zero configuration!</p><p>Tag along to know how those apps work, why are they useful and how you can deploy your own instance.</p><h3>Sickbay</h3><h4>What does it do?</h4><p>Sickbay is a small and simple sinatra app with an endpoint that returns the HTTP status of a bunch of URLs in a single JSON response. It does that by sending a <strong><em>GET</em></strong> request to each URL received.</p><pre>$ curl -X GET &#39;http://localhost:9292?google=http://www.google.com.br&amp;bing=http://www.bing.com&#39;</pre><pre>{<br>  &quot;google&quot;: &quot;200&quot;,<br>  &quot;bing&quot;: &quot;200&quot;<br>}</pre><p>Here&#39;s a link for a <a href="https://sickbay.herokuapp.com">live demo</a>. And <a href="https://sickbay.herokuapp.com/?google=http://www.google.com&amp;bing=http://www.bing.com">this here</a> returns you a link for the HTTP code of a both Google and Bing.</p><h4>Why you should use it?</h4><p>Sickbay can be used to monitor a bunch of health routes at once. With the status you&#39;ve received, you can act accordingly. And that&#39;s exactly what <strong>The Nurse</strong> can do for you.</p><h4>Configuration and Deploy</h4><p>Just push it to Heroku. Simple as that.</p><blockquote>For more details on the implementation of Sickbay, please check the <a href="https://github.com/IgorMarques/sickbay">GitHub repository of the project</a>.</blockquote><h3>The Nurse</h3><h4>What does it do?</h4><p>The Nurse is a small rails app that can alert whoever you want when your apps are in a bad shape. It uses <a href="https://github.com/IgorMarques/sickbay">Sickbay</a> for health checking.</p><h4>How does it work?</h4><ol><li>You can register the apps you want to be monitored (with Name, URL to be checked and the HTTP statuses that indicate your app is fine).</li><li>Every X minutes (completely up to you) The Nurse checks your apps</li><li>If N of last Y requests (again, completely up to you) returns a status code different from the one you expect, The Nurse sends a <strong><em>POST</em></strong> request containing the name of the service, its URL and the last Y HTTP codes received. This POST will be sent to whoever URL you want.</li></ol><p>The app also registers an entry in your DB for each health check. This way you can easily go back in time and check how was your app at any given time.</p><h4>Why you should use it?</h4><p>With The Nurse you can monitor your whole stack at any rate you need and act accordingly when things are going south.</p><h4>Configuration and Deploy</h4><p>You can customize:</p><ul><li>The URLs you want to monitor</li><li>The URL of your Sickbay instance</li><li>The frequency of the checks</li><li>How many fails in the last N requests are enough to trigger a warning (N is also up to you).</li><li>Who should be warned when an outage happens (we call it Doctor (get it??))</li></ul><p>Your Doctor should be able to receive and deal with the following request:</p><pre>{<br>  &quot;service_name&quot;: &quot;TheFailingService&quot;,<br>  &quot;service_url&quot;: &quot;www.this_service_failed.com/health&quot;,<br>  &quot;codes&quot;: [&quot;200&quot;, &quot;500&quot;, &quot;500&quot;]<br>}</pre><p>To check what the environment variables are responsible for each setting, please check the <a href="https://github.com/IgorMarques/The-Nurse#configuring-the-app">Configuring the app</a> section of the repo.</p><p>To deploy the app to Heroku, you&#39;ll need at least one paid dyno, since the free plans only support up to two (and we have three components: the server, Sidekiq and Clockwork). Also remember to properly config a <a href="https://github.com/mperham/sidekiq/wiki/Deployment#heroku">Redis to Go addon</a>.</p><p>All health checks are stored into <a href="https://github.com/IgorMarques/The-Nurse/blob/master/app/models/status.rb">Statuses</a> entries. Feel free to run the SQL or active record queries you like to fetch whatever data you want.</p><p>Example:</p><pre>2.3.1 :013 &gt; Service.first.statuses</pre><pre>Service Load (0.3ms)  SELECT  &quot;services&quot;.* FROM &quot;services&quot; ORDER BY &quot;services&quot;.&quot;id&quot; ASC LIMIT $1  [[&quot;LIMIT&quot;, 1]]</pre><pre>Status Load (40.5ms)  SELECT &quot;statuses&quot;.* FROM &quot;statuses&quot; WHERE &quot;statuses&quot;.&quot;service_id&quot; = $1  [[&quot;service_id&quot;, 1]]</pre><pre><strong>=&gt; #&lt;ActiveRecord::Associations::CollectionProxy [#&lt;Status id: 1, code: 200, service_id: 1, created_at: &quot;2016-11-29 19:25:31&quot;, updated_at: &quot;2016-11-29 19:25:31&quot;&gt;, #&lt;Status id: 3, code: 200, service_id: 1, created_at: &quot;2016-11-30 17:04:08&quot;, updated_at: &quot;2016-11-30 17:04:08&quot;&gt;, #&lt;Status id: 6, code: 200, service_id: 1, created_at: &quot;2016-11-30 17:04:59&quot;, updated_at: &quot;2016-11-30 17:04:59&quot;&gt;, #&lt;Status id: 9, code: 200, service_id: 1, created_at: &quot;2016-11-30 17:05:58&quot;, updated_at: &quot;2016-11-30 17:05:58&quot;&gt;, #&lt;Status id: 12, code: 200, service_id: 1, created_at: &quot;2016-11-30 17:06:59&quot;, updated_at: &quot;2016-11-30 17:06:59&quot;&gt;]&gt;</strong></pre><p>You can do the same for outages:</p><pre>2.3.1 :012 &gt; Service.first.outages</pre><pre>Service Load (0.3ms) SELECT “services”.* FROM “services” ORDER BY “services”.”id” ASC LIMIT $1 [[“LIMIT”, 1]]</pre><pre>Outage Load (0.3ms) SELECT “outages”.* FROM “outages” WHERE “outages”.”service_id” = $1 [[“service_id”, 1]]</pre><pre><strong>=&gt; #&lt;ActiveRecord::Associations::CollectionProxy [#&lt;Outage id: 1, service_id: 1, codes: [500, 500, 500], created_at: “2016–12–02 15:11:52”, updated_at: “2016–12–02 15:11:52”&gt;]&gt;</strong></pre><p>We have plans to add a web interface and endpoints to fetch this data, don&#39;t worry.</p><blockquote>For more details on the implementation, please check the <a href="https://github.com/IgorMarques/The-Nurse">GitHub repository of the project</a>.</blockquote><h3>Next Steps</h3><p>There’s still a lot to be done. Here are some features planned for The Nurse:</p><ul><li>Web interface with the live status of each registered service</li><li>Web interface for managing (creating, editing, deleting, etc) services</li><li>Endpoints for fetching service statuses and outages</li><li>Support for reading data from multiple Sickbay instances at once (for multi-zone purposes)</li></ul><p>Feel free to contribute with a PR on both projects :)</p><blockquote>Enjoyed the idea? Plan to use this stack? Have any suggestions? Feel free to leave a comment!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7255234dbcf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Tips to Stay Organized and Avoid Procrastination]]></title>
            <link>https://medium.com/@igor_marques/simple-tips-to-stay-organized-and-avoid-procrastination-9b0710a00c26?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b0710a00c26</guid>
            <category><![CDATA[lifehacks]]></category>
            <category><![CDATA[organization]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Thu, 20 Oct 2016 20:12:01 GMT</pubDate>
            <atom:updated>2016-10-20T21:21:31.532Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cBVzxqdI1wuYj2_TnAKDjw.jpeg" /></figure><p>This post is a summary of some of my <em>modus operandi</em> when dealing with stuff that requires discipline or that you&#39;re obliged to deal against your will.</p><p>These tips may not work for you, and that&#39;s completely fine! Each person&#39;s mind works in a certain way.</p><p>Let&#39;s start!</p><h3>Get rid of useless distractions on social media</h3><p>Disclaimer: I&#39;m not saying that you need to go completely offline when you&#39;re working on something important (although that works for some people).</p><p>My point here is simple: we see a lot of shit on internet these days. You probably have like 300 friends on Facebook and 90% of them spends their days posting fake news, bad photos of their ugly faces, dated memes and political crap.</p><p>This kind of stuff is only a waste of your time and sanity.</p><p>You don&#39;t need to unfriend people who does this. Simply go to their profile and unfollow them (you can also do that straight from a post of the person). Doing so will not stop being friends with them in the network.</p><p>The same can be achieved with the &quot;mute&quot; function of twitter.</p><p>With Facebook, I also went a step further: I got <a href="http://foxvalleyapps.com/friendsfeed/">this amazing browser extension</a> that simply hides any of those &quot;John Doe commented on this&quot; and &quot;Jane Doe was mentioned on this&quot; from your newsfeed. Seriously, I don&#39;t need to get every crappy post the mother of some friend of mine on my screen just &#39;cause she mentioned him in a cat photo.</p><p>At the time I published this post, this extension is available for both Chrome and Safari (but there’s probably a similar one for other browsers). Unfortunately, I don’t know any alternative for mobile (if you do so, please leave a comment!).</p><p>Another great tip is to mute chat groups that are too noisy or that you are a member “just because” (and this also includes work chat groups).</p><p>After this, your social media experience will be a lot cleaner and less stressfull :)</p><h3>Create a routine</h3><p>This is a hard one, but give it a change. It&#39;s something that works amazingly well to make you do stuff that you&#39;re not exactly excited to do, like go to the gym or work on your thesis for college.</p><p>At first, it&#39;s a struggle to get motivated to do that task but, with time, you&#39;ll don&#39;t need to &quot;find&quot; that motivation everyday since your mind will simply think &quot;ok, now it&#39;s that time of the day when I have to do X&quot;.</p><p>To make sure you&#39;re following the routine you stablished, a good thing to do is…</p><h3>Add reminders for everything</h3><p>Let&#39;s face it: you probably has a lot of things to do and you can probably list me a hole bunch of them. But do you actually remember that you have to do X when you <em>actually</em> need to do it?</p><p>Even if you spend your hole day facing a clock, you&#39;ll still have that moments of &quot;damn, I should&#39;ve done X thirty minutes ago!&quot;.</p><p>And that&#39;s why I add a reminder for almost everything. Need to talk with someone about some topic? There&#39;s a reminder for that. Gotta pay some bill? There&#39;s a reminder for that. And so on and so forth.</p><p>For managing reminders, I use the native Reminders app from macOS since it supports natural language input. So I can easly add a reminder like &quot;Remember to buy milk tomorrow at 8pm&quot; and ta-da! There&#39;s a reminder for that™. The &quot;easiness&quot; of adding new reminders is a killer feature and encourages you to use the app instead of thinking &quot;nah, it&#39;s too hard to add this simple reminder&quot;.</p><p>Other good options are <a href="https://www.google.com/keep">Google Keep</a> and <a href="https://www.google.com/calendar">Google Calendar/Agenda</a>. They&#39;re pretty straightforward and available on a whole bunch of platforms.</p><p>With e-mails, I usually use the snooze feature that some e-mail clients today have. With this, I can reeschedule e-mails to disappear from my inbox until the time I should really deal with them, ensuring that I&#39;ll not let that important e-mail opened at my inbox forever and forgotten. <a href="https://www.google.com/inbox/">Inbox</a> by Google and <a href="https://polymail.io">Polymail</a> support this feature.</p><p>With this in mind, you&#39;ll not waste your time wondering &quot;hmmm, I think I forgot something…&quot; and certainly not actually forgetting something!</p><h3>Deal with quick and/or small stuff as soon as possible</h3><p>This one is kind of a philosophy and comes from a whole bunch of self-organizing books but hey, it actually is a good tip!</p><p>Assuming you have a whole bunch of things to do in your &quot;pile&quot; of things to do, deal with the ones you can deal in two to five minutes as soon as you have time.</p><p>This way you&#39;ll certainly not forget about them (they&#39;re so small that you&#39;ll probably not even care to add a reminder for it if you&#39;re in a lazy mood). You also won&#39;t carry the burden of having to deal with them for the rest of your day (you know, sometimes you just remember that you have to reply THAT e-mail and think: &quot;oh shit, THAT e-mail. Oh man, I hate myself&quot;).</p><p>Face it and deal with small shit right away. You&#39;ll thank yourself later.</p><p>Perhaps all of those tips won&#39;t work for you, but at least give them a try. The ones who do work will sure make you hate yourself way less when you have to pay the price of your procrastination and lazyness.</p><blockquote>Do you have any tips or variations of the ones I mentioned? Leave a comment :)</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b0710a00c26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Basics: Combining two (or more) commits into just one]]></title>
            <link>https://medium.com/@igor_marques/combining-two-commits-84281f470ee8?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/84281f470ee8</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Tue, 04 Oct 2016 17:03:17 GMT</pubDate>
            <atom:updated>2023-01-04T14:14:08.668Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FVQJo95VY5WpJts_4Cg-Mw.png" /><figcaption>A drawing of the phrase &quot;Combining Commits&quot; being crushed.</figcaption></figure><blockquote>This post is an extraction of a subsection of this <a href="https://medium.com/@igor_marques/git-workflow-basics-d405746f6205">git workflow tutorial</a> (with a few additions). If you are interested in learning more about the workflow used by many teams around the world, check it out!</blockquote><p>This post explains one simple way to combine two commits with the <strong>power of git™</strong>.</p><p>I assume you are working on a branch alone to avoid messing around with your teammates&#39; work. Remember: shared branches are usually very hard to maintain.</p><p>Let&#39;s get to the point!</p><p>You have a commit history like this one (older commits on top):</p><pre>f7f3f6d <strong>create file_a</strong> class and methods<br>310154e improve SomeOtherClass code<br>a5f4a0d update changelog<br><strong>a412dbb fix typo on file_a</strong></pre><p>But hey, notice that on commit <strong>a412dbb </strong>you’re fixing something that you just added on this pull-request (on the first commit, to be exact)… It would be nicer to have both the creation and the fix of file_a on only one commit!</p><p>To achieve that, you can use this awesome feature of git: git interactive rebase.</p><p>So we need to merge the first commit (<strong>f7f3f6d</strong> with the last one <strong>a412dbb</strong>). And that’s when the interactive rebase tools comes in hand.</p><pre>$ (some_branch) git rebase -i origin/master</pre><p>The <strong><em>origin/master</em></strong> param is our start point. This basically is telling git: “hey, we want to change the history since the last commit origin/master”, otherwise known as… your branch!</p><p>You can also use <strong><em>HEAD~4</em></strong> as a param, which works like: “hey, we want to change the history since 4 commits behind the current one”. The <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History">official docs</a> has more details on this.</p><p>After executing the command, this file will show up (probably on the vi/vim editor. Check <a href="https://www.fprintf.net/vimCheatSheet.html">this cheatsheet</a> if you don’t know how to use it):</p><pre>pick f7f3f6d create file_a class and methods<br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog<br>pick a412dbb fix typo on file_a</pre><pre># Rebase 710f0f8..a412dbb onto 710f0f8<br>#<br># Commands:<br>#  p, pick = use commit<br>#  r, reword = use commit, but edit the commit message<br>#  e, edit = use commit, but stop for amending<br>#  s, squash = use commit, but meld into previous commit<br>#  f, fixup = like &quot;squash&quot;, but discard this commit&#39;s log message<br>#  x, exec = run command (the rest of the line) using shell<br>#<br># These lines can be re-ordered; they are executed from top to bottom.<br>#<br># If you remove a line here THAT COMMIT WILL BE LOST.<br>#<br># However, if you remove everything, the rebase will be aborted.<br>#<br># Note that empty commits are commented out</pre><p>Now we just need to follow the instructions written there! We want to combine commits <strong>f7f3f6d</strong> and <strong>a412dbb</strong>. So we must reorder the lines to be like this:</p><pre>pick f7f3f6d create file_a class and methods<br><strong>pick a412dbb fix typo on file_a</strong><br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog</pre><p>And we change the <strong>pick</strong><em> </em>label on the a412dbb commit to a <strong>fixup</strong> (or <strong>f</strong>), to tell git: “hey, we want to combine this guy with the one above it”:</p><pre>pick f7f3f6d create file_a class and methods<br><strong>fixup</strong> a412dbb fix typo on file_a<br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog</pre><p>Save your file and bang! Here’s your new commit history:</p><pre><strong>b7c3f33</strong> create file_a class and methods<br><strong>1b24ae9</strong> improve SomeOtherClass code<br><strong>d5ffad3</strong> updates changelog</pre><p>(yeah, the hash of all commits changed due the rewrite of the history).</p><p>If you already pushed your branch to remote, remember to use -f next time you push, since you’ve rewritten the your commit history:</p><pre>$ (some_branch) git push -f origin some_branch</pre><blockquote>Be warned: pushing with -f is a very dangerous thing. Proceed with caution and always be sure that you’re pushing to the right branch.</blockquote><p>And there you go!</p><blockquote>Remember: NEVER rewrite the commit history of public branches (like master). This will truly mess your teammates work.</blockquote><p>To combine three or more commits into just one, just edit your file to be like this:</p><pre>pick f7f3f6d this is my first commit<br>fixup a412dbb this commit will be added to the first one<br>fixup 310154e and this commit too<br>fixup a5f4a0d and also this one</pre><p>All the commits you want to combine into the first one are with the <em>fixup</em> tag.</p><p>And you&#39;re good to go :)</p><p>If you want to simply add a few more changes to your last commit only, it&#39;s even easier. <a href="https://blog.codeminer42.com/git-basics-adding-more-changes-to-your-last-commit-1629344cb9a8#.lx8s1tiq7">Check this post.</a></p><p>Stuff like splitting a commit into different ones and some other crazy ways to change your history are described in the <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History">official git documentation</a>.</p><p>Happy gitting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84281f470ee8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Basics: Adding more changes to your last commit]]></title>
            <link>https://medium.com/@igor_marques/git-basics-adding-more-changes-to-your-last-commit-1629344cb9a8?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/1629344cb9a8</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Tue, 20 Sep 2016 17:11:50 GMT</pubDate>
            <atom:updated>2018-02-04T15:54:51.380Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XFPXLVyqY0kDkvzIOaD9kw.png" /></figure><p>With this post you&#39;ll learn how to modify your last commit, adding (or removing) some changes. You can also follow this tutorial to learn how to edit your last commit message.</p><p>I assume you are working on a branch alone to avoid messing around with your teammates’ work. Remember: shared branches are usually very hard to maintain.</p><p>So you have a commit history like this one (older commits on top):</p><pre>f7f3f6d create file_a class and methods<br>310154e improve SomeOtherClass code<br>a5f4a0d update changelog file</pre><p>But you forgot to add <em>just</em> a single line on the changelog file you mentioned on the commit <strong>a5f4a0d </strong>:(</p><p>You could simply commit it and have a history like this:</p><pre>f7f3f6d create file_a class and methods<br>310154e improve SomeOtherClass code<br>a5f4a0d update changelog file<br>a4gx124 add missing line to changelog</pre><p>But that’s just not good for your history (it’s just a change on a change you already did). The best case scenario here is to have both changes in a <strong>single</strong> commit.</p><p>And you can achieve that with the simply amazing <strong>amend</strong> command!</p><p><strong>Just remember: do not commit any of the changes you want to add to your last commit before doing these steps!</strong></p><h3>The Basic of the Amend Command</h3><p>Just add the modified file(s):</p><pre>$ (some_branch) git add changelog.md</pre><p>And amend it:</p><pre>$ (some_branch) git commit --amend</pre><p>After executing the command, this file will show up (probably on vi/vim. check <a href="https://www.fprintf.net/vimCheatSheet.html">this cheatsheet</a> if you don&#39;t know how to use it):</p><pre>update changelog file</pre><pre># Please enter the commit message for your changes. Lines starting</pre><pre># with ‘#’ will be ignored, and an empty message aborts the commit.</pre><pre>#</pre><pre># Author: John Doe &lt;john@doe.com&gt;</pre><pre># Date: Thu Apr 21 22:40:30 2016 -0300</pre><pre>#</pre><pre># On branch some_branch</pre><pre># Your branch is up-to-date with ‘origin/some_branch’.</pre><pre>#</pre><pre># Changes to be committed:</pre><pre># modified: changelog.md</pre><p>Here you can edit your commit message. Do as you wish and then save the file. If you don’t want to change the message, just save the file without changing it.</p><p>Now the changes you did on the last commit and after it will be in the same commit!</p><h3>Amending a Commit Without Changing Its Message</h3><p>If you don’t want to change your commit message, you can run the amend command with the<strong> no-edit</strong> flag, like this:</p><pre>$ (some_branch) git commit --amend --no-edit</pre><p>You’ll not be &quot;redirected&quot; a file to edit the commit message and that’s it!</p><h3>Pushing an Amended Commit</h3><p>If you haven’t pushed the last commit yet to your remote, a single push is enough. Otherwise, you’ll have to push using the -f option since you’ve rewritten your commit history:</p><pre>$ (some_branch) git push -f origin some_branch</pre><blockquote>Be warned: pushing with -f is a very dangerous thing. Proceed with caution and always be sure that you’re pushing to the right branch.</blockquote><blockquote>Remember: NEVER rewrite the commit history of public branches (like master). This will truly mess your teammates work.</blockquote><h4>Bonus 1: Just Editing a Commit Message</h4><p>To just edit a commit message (without adding new changes to your last commit), just run the amend command without adding changes. Simple as that!</p><h4>Bonus 2: Editing a Commit Without Opening a File</h4><p>Of course there would be a command for that! Just run:</p><pre>$ (some_branch) git commit --amend -m &quot;Your new commit message&quot;</pre><p>And there you go!</p><p>If you wanna learn how to use Git with teams, you should check <a href="https://blog.codeminer42.com/git-workflow-basics-d405746f6205">this other post</a> ;)</p><p>Happy gitting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1629344cb9a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git Workflow Basics]]></title>
            <link>https://medium.com/@igor_marques/git-workflow-basics-d405746f6205?source=rss-b0f7d6f2f5e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d405746f6205</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Igor Marques da Silva]]></dc:creator>
            <pubDate>Wed, 17 Aug 2016 12:58:07 GMT</pubDate>
            <atom:updated>2018-08-08T02:18:34.019Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>This post is intended for beginners, but I assume you already know the basics of <a href="https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository">Git usage</a> (commit, push, pull, etc).</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZUQfs6-kZYkSteBXhkls6A.png" /></figure><p>You probably know how to use <a href="https://git-scm.com">Git</a> on a daily basis. But knowing how to commit, push and pull isn&#39;t enough to <strong>really</strong> work with software development.</p><p>It doesn&#39;t matter if you use GitHub, Bitbucket, GitLab or Stash, one thing is true: you must follow a code review process to ensure your code has minimum quality standard.</p><p>This post will provide you a quick guide on how to use a “open source” workflow in your projects. As the name implies, it&#39;s the same workflow used on a whole bunch of open source projects out there.</p><p>Among the benefits of this workflow are the fact that your <strong>work is completely isolated from everyone else&#39;s</strong> and also the <strong>reduction of error going to production</strong>.</p><p>But hey:<strong> use what works best for your team</strong>. Some variations on this process are welcome as long as they improve your team&#39;s productivity.</p><h3>Working on Branches</h3><p>Git allows you to work on branches. According to the <a href="https://git-scm.com/book/en/v2/Git-Branching-Branches-in-a-Nutshell">git documentation</a>:</p><blockquote>Branching means you diverge from the main line of development and continue to do work without messing with that main line.</blockquote><p>In short, branches isolate the code you are currently working from the code your teammates are working. It&#39;s kinda a &quot;parallel universe&quot;, or timeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XJmL7fWV4Coxt12AzHeG-A.png" /><figcaption>the main line is your <strong>master </strong>branch (main code). See how each branch is isolated from the main code until a certain point</figcaption></figure><p>To create a new branch, you just need to use the <strong><em>git checkout -b &lt;branch_name&gt; </em></strong>command:</p><pre>$ (master) git checkout -b my_new_branch</pre><pre>&gt; Switched to a new branch &#39;my_new_branch&#39;</pre><p>Once in a new branch, the workflow is the same. Create commits for your changes and push them to your repo (but <strong>not</strong> to master):</p><pre>[...] some commits [...]</pre><pre>$ (my_new_branch) git push origin my_new_branch</pre><p>The command above tells git: “hey dude, upload my local work (commits) on <strong>my_new_branch</strong> to the same branch on this remote (origin). If there is no <strong>my_new_branch</strong> there, create it”. If you want your work to be uploaded to a different branch on your remote (other than <strong>my_new_branch</strong>), just use the command like this:</p><pre>$ (my_new_branch) git push origin my_new_branch:my_branch_on_remote</pre><p>Ok, back on track. Now to move back to your <strong>master</strong> branch (or any other branch), you just need to use the git checkout command without the <strong><em>-b</em></strong> param:</p><pre>$ (my_new_branch) git checkout master</pre><pre>&gt; Switched to branch ‘master’</pre><pre>$ (master) git checkout my_new_branch</pre><pre>&gt; Switched to branch ‘my_new_branch’</pre><p>You can have more than one person working on the same branch as you, but that&#39;s not recommended. With one person per branch everyone can make their mess without worrying about disturbing someone else&#39;s work (like writing code that temporary breaks some part of the application, for example).</p><p>But someday you&#39;ll need to integrate your brand new feature back to your master right?</p><h3>Code review</h3><p>Instead of merging your branch back to master right away, a good practice of software development is to request your new code to be reviewed by other team members before.</p><p><strong>This tends to increase the code quality of your app, since more people will take a look at it</strong>, spotting improvements and even small bugs before it reaches production.</p><p>For beginners, this is an awesome way to learn new stuff from more experienced developers.</p><p>But how to get people to review your code? Ask them to pull your branch and look into every commit by hand? No way!</p><p>Most (if not all of) Git online repository services have a nice feature that makes code review be very easy.</p><h4>Pull Requests</h4><p>A pull request (or a merge request, if you use GitLab) can be defined as:</p><blockquote>Pull requests let you tell others about changes you’ve pushed to a repository on GitHub. Once a pull request is sent, interested parties can review the set of changes, discuss potential modifications, and even push follow-up commits if necessary.</blockquote><blockquote>source: <a href="https://help.github.com/articles/using-pull-requests/">GitHub help: Using pull requests</a></blockquote><p><strong>It&#39;s basically a way to allow your teammates to review the code of your branch on the web interface of your repo</strong>. It allows them to make comments about the code that is about to be merged to the master.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEeoXw0SzX67VRsfGHi5NQ.png" /><figcaption>example of a comment on a line change</figcaption></figure><p>You can learn how to create and mantain a pull request <a href="https://help.github.com/articles/using-pull-requests/">here</a> (the same link I mentioned above). Each other service follows the same pattern, so there&#39;s no mystery involved.</p><p>Even after opening a pull request, you&#39;re still able to push new commits to your branch. You can use that to get early reviews of your code and keep working on some other part while people review what you&#39;ve already uploaded.</p><p>And hey: <strong>remember to review your own pull request</strong> before asking for reviews of your teammates. You&#39;ll spot a lot of small things you didn&#39;t notice (style issues, typos, etc) and will allow your colleagues to focus on what really matters.</p><p>But again, your code isn&#39;t on the master branch yet, right? Hold on, we&#39;re almost there!</p><h3>Refactoring/ Fixing Stuff</h3><p>If your teammates asks for reasonable changes in your code, you&#39;ll have to do it (for the sake of code quality). Let&#39;s take a look on a scenario that happens very often: adding new changes to a past commit.</p><p>So, this is your file_a.example (yeah, the typo is on purpose):</p><pre>[...]</pre><pre>some_cool_function</pre><pre>some_coler_function</pre><pre>[...]</pre><p>And this is your commit history (older commits on top):</p><pre>f7f3f6d create file_a class and methods<br>310154e improve SomeOtherClass code<br>a5f4a0d update changelog</pre><p>Someone points out that your <strong><em>some_coler_function </em></strong>has a typo on its name and now you have to fix it.</p><p>You update the file and commit the fix. And now here&#39;s your new commit history:</p><pre>f7f3f6d create file_a class and methods<br>310154e improve SomeOtherClass code<br>a5f4a0d update changelog<br><strong>a412dbb fix typo on file_a</strong></pre><p>But hey, you&#39;re fixing something that you just added on this pull-request (on the first commit, to be exact)… It would be nicer to have both the creation and the fix of file_a on only one commit, right?</p><p>Git is such a wonderful tool and has this killer command that <strong>allows us to change previously stablished commits</strong>: git interactive rebase.</p><p>So we need to merge the first commit (<strong>f7f3f6d</strong> with the last one <strong>a412dbb</strong>). And that&#39;s when the interactive rebase tools comes in hand.</p><pre>$ (some_branch) git rebase -i origin/master</pre><p>The <strong><em>origin/master</em></strong> param is our start point. This basically is telling git: &quot;hey, we want to change the history since the last commit origin/master&quot;, otherwise known as… your branch!</p><p>You can also use <strong><em>HEAD~4</em></strong> as a param, which works like: “hey, we want to change the history since 4 commits behind the current one”. The <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History">official docs</a> has more details on this.</p><p>After executing the command, this will be your screen:</p><pre>pick f7f3f6d create file_a class and methods<br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog<br>pick a412dbb fix typo on file_a</pre><pre># Rebase 710f0f8..a412dbb onto 710f0f8<br>#<br># Commands:<br>#  p, pick = use commit<br>#  r, reword = use commit, but edit the commit message<br>#  e, edit = use commit, but stop for amending<br>#  s, squash = use commit, but meld into previous commit<br>#  f, fixup = like &quot;squash&quot;, but discard this commit&#39;s log message<br>#  x, exec = run command (the rest of the line) using shell<br>#<br># These lines can be re-ordered; they are executed from top to bottom.<br>#<br># If you remove a line here THAT COMMIT WILL BE LOST.<br>#<br># However, if you remove everything, the rebase will be aborted.<br>#<br># Note that empty commits are commented out</pre><p>Now we just need to follow the instructions written there! We want to combine commits f7f3f6d and a412dbb. So we must reorder the lines to be like this:</p><pre>pick f7f3f6d create file_a class and methods<br><strong>pick a412dbb fix typo on file_a</strong><br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog</pre><p>And we change the <strong>pick</strong><em> </em>label on the a412dbb commit to a <strong>fixup</strong> (or <strong>f</strong>), to tell git: &quot;hey, we want to combine this guy with the one above it&quot;:</p><pre>pick f7f3f6d create file_a class and methods<br><strong>fixup</strong> a412dbb fix typo on file_a<br>pick 310154e improve SomeOtherClass code<br>pick a5f4a0d update changelog</pre><p>Save your file and bang! Here&#39;s your new commit history:</p><pre><strong>b7c3f33</strong> create file_a class and methods<br><strong>1b24ae9</strong> improve SomeOtherClass code<br><strong>d5ffad3</strong> updates changelog</pre><p>(yeah, the hash of all commits changed due the rewrite of the history).</p><p>If you already pushed your branch to remote, remember to use -f next time you push, since you&#39;ve rewritten your commit history:</p><pre>$ (some_branch) git push -f origin some_branch</pre><blockquote>Be warned: pushing with -f is a very dangerous thing. Proceed with caution and always be sure that you&#39;re pushing to the right branch.</blockquote><p>And there you go!</p><p>Stuff like splitting a commit into different ones and some other crazy ways to change your history are described in the <a href="https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History">official git documentation</a>.</p><blockquote><strong>Remember: NEVER rewrite the commit history of public branches (like master). This will truly mess your teammates work.</strong></blockquote><p>Finally, it&#39;s time to…</p><h3>Integrating your code</h3><p>Teams usually establish a minimum amount of reviews to get a pull request merged. Once you get the enough numbers of eyes on your code, designate someone to merge it! You can also merge yourself, but that&#39;s not the usual on most teams.</p><p>And that&#39;s it! Your code is now on your master branch, ready to ship to production.</p><p>Now you know how to use the workflow followed by thousands of teams of software development around the world!</p><p>With this workflow, you <strong>prevent people from stepping on each others toes</strong> while working and <strong>ensure that the code that goes to production has been <em>approved</em> by a minimum number of developers</strong>.</p><p>If you are in a team that doesn&#39;t follow this pattern, propose this change to them. The benefits are crystal clear and the effort to achieve that is close to zero.</p><p>Happy gitting!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d405746f6205" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>