<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>git &amp;mdash; Attach to Process</title>
    <link>https://devblog.dinobansigan.com/tag:git</link>
    <description>Thoughts and Notes on Software Development</description>
    <pubDate>Tue, 14 Apr 2026 11:58:05 +0000</pubDate>
    <image>
      <url>https://i.snap.as/4wmUdb6N.png</url>
      <title>git &amp;mdash; Attach to Process</title>
      <link>https://devblog.dinobansigan.com/tag:git</link>
    </image>
    <item>
      <title>Trying to Understand Revert And Merges in Git</title>
      <link>https://devblog.dinobansigan.com/trying-to-understand-revert-and-merges-in-git?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Disclaimer: I&#39;m not an expert in Git. This post is me trying to understand how it works, by trying to explain it to someone else. If I&#39;ve said something wrong in this post, please don&#39;t hesitate to correct me by leaving a comment below or getting in touch with me.&#xA;&#xA;So, in the past, I got confused by how a git revert command affected the merges. Part of it is due to my TFS background. But anyway, as it turns out, it works exactly how it is supposed to work, once you have a better understanding of how Git works. &#xA;&#xA;A git revert rolls back a specific commit made in the repo. In addition to that, it adds a new commit to indicate that the previous commit was rolled back.&#xA;&#xA;To better explain how this affects merges, I&#39;ll try to go over a scenario where I merge branches, then revert a commit in one branch, then try to merge the branches again. So here goes.&#xA;&#xA;Imagine that I have two branches, develop and master. The develop branch was created based off the master branch, so they should have the same code in them.!--more--&#xA;&#xA;Let&#39;s say that in the develop branch, there were new commits added. Let&#39;s call them Commit 1A, Commit 1B and Commit 1C.&#xA;&#xA;Then I decided to merge develop into master. &#xA;&#xA;After the merge, both branches are in sync again. If you look at the history of commits into both branches, at the top of the list would be Commit 1C, then Commit 1B then Commit 1A.&#xA;&#xA;Depending on how you do your merges, the master branch would normally have an extra commit showing the merge from the develop branch. Let&#39;s call that Commit 2A. But after that commit though, you would still see Commit 1C, then Commit 1B then Commit 1A, just like in the develop branch.&#xA;&#xA;Anyway the point is, at this moment in time, both branches have the same set of changes/commits. Everything that is in the develop branch, is also in the master branch.&#xA;&#xA;Table below shows the history of commits for both branches.&#xA;&#xA;| develop | master |&#xA;| --- | --- |&#xA;| Commit 1C | Commit 2A |&#xA;| Commit 1B | Commit 1C |&#xA;| Commit 1A | Commit 1B |&#xA;| ... | Commit 1A |&#xA;&#xA;But then I decided to revert a change in the master branch because it broke something. Let&#39;s say I reverted Commit 1B in the master branch. Since a git revert command creates a new commit, it will show up in the history for the master branch too. Let&#39;s call this Commit 2B.&#xA;&#xA;Around the same time, I also pushed new code to the develop branch. Let&#39;s say that was Commit 1D.&#xA;&#xA;The updated table below shows the commits for both branches at this point in time.&#xA;&#xA;| develop | master |&#xA;| ----- | ----- |&#xA;| Commit 1D | Commit 2B |&#xA;| Commit 1C | Commit 2A |&#xA;| Commit 1B | Commit 1C |&#xA;| Commit 1A | Commit 1B |&#xA;| ... | Commit 1A |&#xA;&#xA;And so what happens now when I merge the develop branch into the master branch?&#xA;&#xA;Previously, I expected that if I merged develop into master at this point in time:&#xA;&#xA;I would get Commit 1D added to the master branch and...&#xA;I would get Commit 1B added back to the master branch...&#xA;&#xA;But that is not how Git works. At least not for the 2nd expectation. That may be the case with a merge in TFS, but not in Git. And that&#39;s because of the effect of the git revert command and how Git compares differences between branches during a merge.&#xA;&#xA;The git revert command creates a new commit to track the rolling back of a previous commit. In this case, it created Commit 2B. When you merge develop into the master branch at this point, Git will look at the commit history in the develop branch and will say, &#34;Hey, the master branch has all of the same commits except Commit 1D, so I&#39;ll only add Commit 1D into the master branch.&#34;&#xA;&#xA;So what about Commit 1B that was reverted in the master branch, but is still in the develop branch? Why was that not merged? &#xA;&#xA;Since merges are directional (source branch to target branch), Git sees that Commit 1B in the develop branch (source branch) is already in the history of commits for the master branch (target branch). So as far as a merge goes, Commit 1B is already in the master branch and so there is no need to add it during a merge.&#xA;&#xA;Now if you were to reverse the direction of the merge, if you were to merge the master branch into the develop branch, Git will now see that Commit 1B was reverted in the master branch (source branch) via Commit 2B. And so Git will then revert Commit 1B in the develop branch (target branch) by copying the changes from Commit 2B as part of the merge.&#xA;&#xA;So, there you go. I hope this post can help someone else who had trouble understanding how reverts and merges work in Git.&#xA;&#xA;Tags: #Git&#xA;&#xA;---&#xA;Useful References:&#xA;&#xA;How Git Works&#xA;The Ultimate Guide to Git Reset and Git Revert (freecodecamp.org)&#xA;&#xA;---&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/trying-to-understand-revert-and-merges-in-git&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p><em>Disclaimer: I&#39;m not an expert in Git. This post is me trying to understand how it works, by trying to explain it to someone else. If I&#39;ve said something wrong in this post, please don&#39;t hesitate to correct me by leaving a comment below or <a href="https://devblog.dinobansigan.com/contact">getting in touch with me</a>.</em></p>

<p>So, in the past, I got confused by how a <code>git revert</code> command affected the merges. Part of it is due to my TFS background. But anyway, as it turns out, it works exactly how it is supposed to work, once you have a better understanding of how Git works.</p>

<p>A <code>git revert</code> rolls back a specific commit made in the repo. In addition to that, it adds a new commit to indicate that the previous commit was rolled back.</p>

<p>To better explain how this affects merges, I&#39;ll try to go over a scenario where I merge branches, then revert a commit in one branch, then try to merge the branches again. So here goes.</p>

<p>Imagine that I have two branches, <code>develop</code> and <code>master</code>. The <code>develop</code> branch was created based off the <code>master</code> branch, so they should have the same code in them.</p>

<p>Let&#39;s say that in the <code>develop</code> branch, there were new commits added. Let&#39;s call them Commit 1A, Commit 1B and Commit 1C.</p>

<p>Then I decided to merge <code>develop</code> into <code>master</code>.</p>

<p>After the merge, both branches are in sync again. If you look at the history of commits into both branches, at the top of the list would be Commit 1C, then Commit 1B then Commit 1A.</p>

<p>Depending on how you do your merges, the <code>master</code> branch would normally have an extra commit showing the merge from the <code>develop</code> branch. Let&#39;s call that Commit 2A. But after that commit though, you would still see Commit 1C, then Commit 1B then Commit 1A, just like in the <code>develop</code> branch.</p>

<p>Anyway the point is, at this moment in time, both branches have the same set of changes/commits. Everything that is in the <code>develop</code> branch, is also in the <code>master</code> branch.</p>

<p><em>Table below shows the history of commits for both branches.</em></p>

<table>
<thead>
<tr>
<th>develop</th>
<th>master</th>
</tr>
</thead>

<tbody>
<tr>
<td>Commit 1C</td>
<td>Commit 2A</td>
</tr>

<tr>
<td>Commit 1B</td>
<td>Commit 1C</td>
</tr>

<tr>
<td>Commit 1A</td>
<td>Commit 1B</td>
</tr>

<tr>
<td>...</td>
<td>Commit 1A</td>
</tr>
</tbody>
</table>

<p>But then I decided to revert a change in the <code>master</code> branch because it broke something. Let&#39;s say I reverted Commit 1B in the <code>master</code> branch. Since a <code>git revert</code> command creates a new commit, it will show up in the history for the <code>master</code> branch too. Let&#39;s call this Commit 2B.</p>

<p>Around the same time, I also pushed new code to the <code>develop</code> branch. Let&#39;s say that was Commit 1D.</p>

<p><em>The updated table below shows the commits for both branches at this point in time.</em></p>

<table>
<thead>
<tr>
<th>develop</th>
<th>master</th>
</tr>
</thead>

<tbody>
<tr>
<td>Commit 1D</td>
<td>Commit 2B</td>
</tr>

<tr>
<td>Commit 1C</td>
<td>Commit 2A</td>
</tr>

<tr>
<td>Commit 1B</td>
<td>Commit 1C</td>
</tr>

<tr>
<td>Commit 1A</td>
<td>Commit 1B</td>
</tr>

<tr>
<td>...</td>
<td>Commit 1A</td>
</tr>
</tbody>
</table>

<p>And so what happens now when I merge the <code>develop</code> branch into the <code>master</code> branch?</p>

<p>Previously, I expected that if I merged <code>develop</code> into <code>master</code> at this point in time:</p>
<ol><li>I would get Commit 1D added to the <code>master</code> branch and...</li>
<li>I would get Commit 1B <em>added back</em> to the <code>master</code> branch...</li></ol>

<p>But that is not how Git works. At least not for the 2nd expectation. That may be the case with a merge in TFS, but not in Git. And that&#39;s because of the effect of the <code>git revert</code> command and how Git compares differences between branches during a merge.</p>

<p>The <code>git revert</code> command creates a new commit to track the rolling back of a previous commit. <em>In this case, it created Commit 2B.</em> When you merge <code>develop</code> into the <code>master</code> branch at this point, Git will look at the commit history in the <code>develop</code> branch and will say, <em>“Hey, the master branch has all of the same commits except Commit 1D, so I&#39;ll only add Commit 1D into the master branch.”</em></p>

<p>So what about Commit 1B that was reverted in the <code>master</code> branch, but is still in the <code>develop</code> branch? Why was that not merged?</p>

<p>Since merges are directional (source branch to target branch), Git sees that Commit 1B in the <code>develop</code> branch (source branch) is already in the history of commits for the <code>master</code> branch (target branch). So as far as a merge goes, Commit 1B is already in the <code>master</code> branch and so there is no need to add it during a merge.</p>

<p>Now if you were to reverse the direction of the merge, if you were to merge the <code>master</code> branch into the <code>develop</code> branch, Git will now see that Commit 1B was reverted in the <code>master</code> branch (source branch) via Commit 2B. And so Git will then revert Commit 1B in the <code>develop</code> branch (target branch) by copying the changes from Commit 2B as part of the merge.</p>

<p>So, there you go. I hope this post can help someone else who had trouble understanding how reverts and merges work in Git.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:Git" class="hashtag"><span>#</span><span class="p-category">Git</span></a></em></p>

<hr/>

<p>Useful References:</p>
<ul><li><a href="https://www.pluralsight.com/courses/how-git-works">How Git Works</a></li>
<li><a href="https://www.freecodecamp.org/news/the-ultimate-guide-to-git-reset-and-git-revert/#:~:text=Git%20Revert%201%20Revert%20a%20commit%20or%20set,and%20you%20add%20and%20commit%20your%20changes.%202.%29">The Ultimate Guide to Git Reset and Git Revert (freecodecamp.org)</a></li></ul>

<hr/>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/trying-to-understand-revert-and-merges-in-git">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/trying-to-understand-revert-and-merges-in-git</guid>
      <pubDate>Tue, 13 Sep 2022 13:15:07 +0000</pubDate>
    </item>
    <item>
      <title>Git Config</title>
      <link>https://devblog.dinobansigan.com/git-config?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[To get a list of the global config options for Git, you can run this:&#xA;git config --global --list&#xA;&#xA;When setting config options, you need to add the location of the config file. So for example, if you want to set core.autocrlf to false as a global or system option, you can run either one of the following commands (depending on the location you want to run it for):&#xA;git config --global core.autocrlf false&#xA;git config --system core.autocrlf false&#xA;&#xA;Tags: #Git&#xA;&#xA;!--emailsub--&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/git-config&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>To get a list of the global config options for Git, you can run this:</p>

<pre><code>git config --global --list
</code></pre>

<p>When setting config options, you need to add the location of the config file. So for example, if you want to set <code>core.autocrlf</code> to <code>false</code> as a <code>global</code> or <code>system</code> option, you can run either one of the following commands (depending on the location you want to run it for):</p>

<pre><code>git config --global core.autocrlf false
git config --system core.autocrlf false
</code></pre>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:Git" class="hashtag"><span>#</span><span class="p-category">Git</span></a></em></p>



<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/git-config">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/git-config</guid>
      <pubDate>Thu, 15 Jul 2021 00:00:00 +0000</pubDate>
    </item>
    <item>
      <title>Git Pull vs Git Fetch</title>
      <link>https://devblog.dinobansigan.com/git-pull-vs-git-fetch?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[The git pull command is basically like &#34;Get Latest Version&#34; in TFS. It pulls down the latest changes for a repository and merges them into the local files in your computer. &#xA;&#xA;I don&#39;t think there is an equivalent in TFS for the git fetch command. The closest thing to it in TFS is probably viewing history, then manually checking to see what changes you are missing. Or doing a merge of branches to see what is different. &#xA;&#xA;In comparison to the git pull command, running git fetch will not pull down any changes. From what I understand, all it does is compare the changes/code in the remote repository with your own local repository. Then it can tell you whether your local repository is behind or ahead, as far as changes go, with the remote repository. This is even better than what you can do in TFS, because it allows you to see exactly what changes you don&#39;t have on your local repository.&#xA;&#xA;Tags: #Git #TeamFoundationServer&#xA;&#xA;!--emailsub--&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/git-pull-vs-git-fetch&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>The <code>git pull</code> command is basically like “Get Latest Version” in TFS. It pulls down the latest changes for a repository and merges them into the local files in your computer.</p>

<p>I don&#39;t think there is an equivalent in TFS for the <code>git fetch</code> command. The closest thing to it in TFS is probably viewing history, then manually checking to see what changes you are missing. Or doing a merge of branches to see what is different.</p>

<p>In comparison to the <code>git pull</code> command, running <code>git fetch</code> will not pull down any changes. From what I understand, all it does is compare the changes/code in the remote repository with your own local repository. Then it can tell you whether your local repository is behind or ahead, as far as changes go, with the remote repository. This is even better than what you can do in TFS, because it allows you to see exactly what changes you don&#39;t have on your local repository.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:Git" class="hashtag"><span>#</span><span class="p-category">Git</span></a> <a href="https://devblog.dinobansigan.com/tag:TeamFoundationServer" class="hashtag"><span>#</span><span class="p-category">TeamFoundationServer</span></a></em></p>



<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/git-pull-vs-git-fetch">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/git-pull-vs-git-fetch</guid>
      <pubDate>Tue, 13 Jul 2021 17:30:30 +0000</pubDate>
    </item>
    <item>
      <title>Git Source Code Annotations in Visual Studio Code</title>
      <link>https://devblog.dinobansigan.com/git-source-code-annotations-in-visual-studio-code?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[Visual Studio, when used with TFS (Team Foundation Server), has this feature called &#34;Annotate&#34;. You get to it by right clicking somewhere in the code, then selecting Source, then Annotate. &#xA;&#xA;Doing so shows you who made changes, when those changes were made, and what changeset those changes belong to, for the specific line of code you are looking at. It&#39;s pretty helpful especially when you&#39;re trying to understand the context or history of a specific line of code.&#xA;&#xA;I&#39;ve been looking for the same feature in Visual Studio Code. Unfortunately, this feature doesn&#39;t exist when using Git with Visual Studio Code. But, you can install an extension called Gitlens that does the same thing and then some.&#xA;&#xA;And just to clarify, there is no &#34;Annotate&#34; command/feature in Git. But there is a corresponding one called git-blame.&#xA;&#xA;Tags: #VisualStudioCode #Extensions #Git&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/git-source-code-annotations-in-visual-studio-code&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>Visual Studio, when used with TFS (Team Foundation Server), has this feature called “Annotate”. You get to it by right clicking somewhere in the code, then selecting <code>Source</code>, then <code>Annotate</code>.</p>

<p>Doing so shows you who made changes, when those changes were made, and what changeset those changes belong to, for the specific line of code you are looking at. It&#39;s pretty helpful especially when you&#39;re trying to understand the context or history of a specific line of code.</p>

<p>I&#39;ve been looking for the same feature in Visual Studio Code. Unfortunately, this feature doesn&#39;t exist when using Git with Visual Studio Code. But, you can install an extension called <a href="https://github.com/eamodio/vscode-gitlens">Gitlens</a> that does the same thing and then some.</p>

<p>And just to clarify, there is no “Annotate” command/feature in Git. But there is a corresponding one called <a href="https://www.git-scm.com/docs/git-blame">git-blame</a>.</p>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:VisualStudioCode" class="hashtag"><span>#</span><span class="p-category">VisualStudioCode</span></a> <a href="https://devblog.dinobansigan.com/tag:Extensions" class="hashtag"><span>#</span><span class="p-category">Extensions</span></a> <a href="https://devblog.dinobansigan.com/tag:Git" class="hashtag"><span>#</span><span class="p-category">Git</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/git-source-code-annotations-in-visual-studio-code">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/git-source-code-annotations-in-visual-studio-code</guid>
      <pubDate>Tue, 04 May 2021 03:22:09 +0000</pubDate>
    </item>
    <item>
      <title>Basics of Using Git from the Command Line</title>
      <link>https://devblog.dinobansigan.com/basics-of-using-git-from-the-command-line?pk_campaign=rss-feed</link>
      <description>&lt;![CDATA[I was looking for the shortest tutorial on the basics of using Git from the command line. This one, Git Tutorial 4: Basic Commands: add, commit, push from YouTube was pretty good.&#xA;&#xA;Here are some notes I made from watching that video:&#xA;&#xA;The git status command will show you files and folders that have changes. It also shows you files that you&#39;ve already committed into your local repository, but haven&#39;t pushed yet into a remote server.&#xA;The git add command adds files that have changes into a staging area on your local computer.&#xA;The git commit command will commit those changes into your local repository. Emphasis on local. At this point your changes are not saved to a remote server like Github just yet. The committed changes are still on your local Git repository.&#xA;The git push command is the one that will send your changes up to your remote Github repository.&#xA;&#xA;This next tip is not something I learned from the video, but from someplace else that I don&#39;t remember.&#xA;&#xA;To get out of a long results screen from using the git log command, you can type q.&#xA;&#xA;Tags: #Git&#xA;&#xA;a href=&#34;https://remark.as/p/devblog.dinobansigan.com/basics-of-using-git-from-the-command-line&#34;Discuss.../a or leave a comment below.]]&gt;</description>
      <content:encoded><![CDATA[<p>I was looking for the shortest tutorial on the basics of using Git from the command line. This one, <a href="https://www.youtube.com/watch?v=eL_0Ok_Gkas">Git Tutorial 4: Basic Commands: add, commit, push</a> from YouTube was pretty good.</p>

<p>Here are some notes I made from watching that video:</p>
<ul><li>The <code>git status</code> command will show you files and folders that have changes. It also shows you files that you&#39;ve already committed into your local repository, but haven&#39;t pushed yet into a remote server.</li>
<li>The <code>git add</code> command adds files that have changes into a staging area on your local computer.</li>
<li>The <code>git commit</code> command will commit those changes into your <strong>local</strong> repository. Emphasis on <em>local</em>. At this point your changes are not saved to a remote server like Github just yet. The committed changes are still on your local Git repository.</li>
<li>The <code>git push</code> command is the one that will send your changes up to your remote Github repository.</li></ul>

<p>This next tip is not something I learned from the video, but from someplace else that I don&#39;t remember.</p>
<ul><li>To get out of a long results screen from using the <code>git log</code> command, you can type <code>q</code>.</li></ul>

<p><em>Tags: <a href="https://devblog.dinobansigan.com/tag:Git" class="hashtag"><span>#</span><span class="p-category">Git</span></a></em></p>

<p><strong><a href="https://remark.as/p/devblog.dinobansigan.com/basics-of-using-git-from-the-command-line">Discuss...</a></strong> or leave a comment below.</p>
]]></content:encoded>
      <guid>https://devblog.dinobansigan.com/basics-of-using-git-from-the-command-line</guid>
      <pubDate>Tue, 26 Jan 2021 02:00:00 +0000</pubDate>
    </item>
  </channel>
</rss>