<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Git on Mazer.dev</title><link>https://mazer.dev/en/tags/git/</link><description>Recent content in Git on Mazer.dev</description><generator>Hugo</generator><language>en</language><copyright>Copyright © 2016-2025 Ademir Mazer Junior. All Rights Reserved.</copyright><lastBuildDate>Wed, 13 Nov 2024 00:00:00 +0000</lastBuildDate><atom:link href="https://mazer.dev/en/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>Ignoring File Permission Changes in Git</title><link>https://mazer.dev/en/git/tips/ignoring-file-permission-changes-in-git/</link><pubDate>Wed, 13 Nov 2024 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/tips/ignoring-file-permission-changes-in-git/</guid><description><![CDATA[<p>For intermediary Git users, it&rsquo;s important to understand how to manage file permissions within your repository.
Sometimes, especially when collaborating across different operating systems or development environments,
file permissions can appear as changes in your Git status, even when the actual content remains unchanged.
This can clutter your commit history and create unnecessary noise.</p>
<p>Let&rsquo;s understand in this article: how to instruct Git to ignore these permission modifications.</p>

<h2 id="understanding-the-issue-with-file-permission-change-on-git" data-numberify>Understanding the Issue with file permission change on Git<a class="anchor ms-1" href="#understanding-the-issue-with-file-permission-change-on-git"></a></h2>
<p>Git tracks file permissions (execute, read, write) as part of its change tracking mechanism.
When permissions are modified (e.g., using <code>chmod</code>), Git sees this as a change, even if the file content
itself is identical.</p>]]></description><enclosure url="https://mazer.dev/images/git/git-permissions.webp" length="511098" type="image/.webp"/></item><item><title>Git Folders and Files Structure</title><link>https://mazer.dev/en/git/introduction/git-structure/</link><pubDate>Thu, 25 Jan 2024 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/git-structure/</guid><description><![CDATA[<p>After some time using Git, you almost certainly know the best ways to use it every day, including the most useful commands.</p>
<p>When you achieve this level of understanding of how to use a tool, it&rsquo;s time to delve deeper into its concepts, architecture, and structure.</p>
<p>In this post, we will understand how Git organizes its information and how it persists this information in its file structure.</p>

<h2 id="the-head-in-githead" data-numberify>The HEAD in .git/HEAD<a class="anchor ms-1" href="#the-head-in-githead"></a></h2>
<p><strong>HEAD</strong> is a file that contains the name of the <em>current</em> <code>branch</code>.</p>]]></description><enclosure url="https://mazer.dev/images/git/git-maestro-folders.webp" length="415668" type="image/.webp"/></item><item><title>What does `git rm` do</title><link>https://mazer.dev/en/git/introduction/tag-branch-difference-in-git/</link><pubDate>Tue, 22 Aug 2023 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/tag-branch-difference-in-git/</guid><description></description></item><item><title>How To Delete A Local Branch In GIT</title><link>https://mazer.dev/en/git/tips/how-delete-local-git-branch/</link><pubDate>Tue, 20 Jun 2023 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/tips/how-delete-local-git-branch/</guid><description><![CDATA[<p>Git, a powerful version control system, is an essential tool for developers. It helps to track changes in the source
code, allowing for collaborative work and recovery in case of errors. One key feature of Git is its <a href="/en/git/introduction/tag-branch-difference-in-git/">branching
mechanosm</a>. Branches allow you to diverge from the main line of development and create isolated environments where
you can work on updates or experiment without affecting the main line.</p>
<p>However, over time, as the number of branches in your repository grows, it becomes necessary to perform some
housekeeping to maintain order and optimize your workflow. Deleting branches that are no longer needed can be a key
part of this cleanup process.</p>]]></description><enclosure url="https://mazer.dev/images/git/git-delete-local-branch.jpg" length="517375" type="image/.jpg"/></item><item><title>Git Config: Username and Email Configuration</title><link>https://mazer.dev/en/git/introduction/git-config-username-email/</link><pubDate>Wed, 12 Apr 2023 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/git-config-username-email/</guid><description><![CDATA[<p>Configuring your Git username and email is essential for accurate commit attribution, traceability,
effective collaboration, and compliance within a development environment.</p>
<p>There are some reasons to right set git username and email:</p>
<ul>
<li>
<p><strong>Commit attribution</strong>: When you make changes to a codebase, Git records these changes as commits.
Each commit includes information about the author, such as their name and email address. By configuring your
Git username and email, you ensure that your commits are accurately attributed to you, allowing other team members
or collaborators to identify who made specific changes.</p>]]></description><enclosure url="https://mazer.dev/en/git/introduction/git-config-username-email/featured-git-config-username-email.webp" length="50812" type="image/webp"/></item><item><title>Tag and Branch difference in Git</title><link>https://mazer.dev/en/git/introduction/tag-branch-difference-in-git/</link><pubDate>Thu, 02 Feb 2023 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/tag-branch-difference-in-git/</guid><description><![CDATA[<p>Do you know how the conceptual difference and usability of tag and branch in git?</p>
<p>Short answer:</p>
<p><em>A <code>branch</code> in Git is a movable pointer to a specific commit that allows independent development and merging with the main codebase, while a <code>tag</code> is a static marker for a specific version in the Git history that provides a way to easily reference a stable code release.</em></p>

<h2 id="what-is-a-branch-in-git" data-numberify>What is a Branch in Git<a class="anchor ms-1" href="#what-is-a-branch-in-git"></a></h2>
<p>A Git <strong>branch</strong> is a way to separate work in progress from the main codebase. It allows multiple developers to work on different features or bug fixes in parallel, without affecting the main codebase. Branches are lightweight and can be easily created, merged, and deleted, making them ideal for daily development work.</p>]]></description><enclosure url="https://mazer.dev/en/git/introduction/tag-branch-difference-in-git/featured-branch-tag.jpg" length="65404" type="image/jpeg"/></item><item><title>What is the Git index</title><link>https://mazer.dev/en/git/introduction/git-index/</link><pubDate>Wed, 21 Dec 2022 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/git-index/</guid><description><![CDATA[<p>This is a recurring question: &ldquo;Why keep the git index?&rdquo; or, &ldquo;The git index is a performance trick?&rdquo;</p>
<p>Actually, the git index is a <em>staging</em> area. Every SCM (Source Code Manager) has it, the difference is that git shows it to you, and uses it <strong>effectively</strong>.</p>

<h2 id="git-staging-area" data-numberify>Git staging area<a class="anchor ms-1" href="#git-staging-area"></a></h2>
<p>When you do:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git add some.file
</span></span><span class="line"><span class="cl">git commit -m <span class="s1">&#39;message&#39;</span>
</span></span></code></pre></div><p>The first command, <code>git add some.file</code> <strong>does not</strong> commit the file, right? Where has it gone? Answer: into the <strong>staging area</strong>.</p>]]></description><enclosure url="https://mazer.dev/en/git/introduction/git-index/featured-index.webp" length="776942" type="image/webp"/></item><item><title>How to Use Git Uncommit to Revert Changes</title><link>https://mazer.dev/en/git/tips/how-uncommit-undo-last-commit-not-pushed/</link><pubDate>Fri, 16 Dec 2022 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/tips/how-uncommit-undo-last-commit-not-pushed/</guid><description><![CDATA[<p>In this post, we&rsquo;ll cover how to uncommit in Git. If you mistakenly executed a <code>git commit</code> but haven&rsquo;t pushed it to the remote repository yet, you can undo the last commit without losing your changes or data.</p>

<h2 id="git-uncommit-how-to-undo-the-last-commit" data-numberify>Git Uncommit: How to Undo the Last Commit<a class="anchor ms-1" href="#git-uncommit-how-to-undo-the-last-commit"></a></h2>
<p>Although there&rsquo;s no specific <code>git uncommit</code> or <code>git undo</code> command, Git provides other commands like <code>git reset</code>, <code>git clean</code>, and <code>git revert</code> to manage workflows.</p>]]></description><enclosure url="https://mazer.dev/en/git/tips/how-uncommit-undo-last-commit-not-pushed/featured-undo.jpg" length="161137" type="image/jpeg"/></item><item><title>How to solve the error in Git 'Fatal: Branch Rename Failed'</title><link>https://mazer.dev/en/git/troubleshooting/how-to-solve-the-error-git-fatal-branch-rename-failed/</link><pubDate>Fri, 30 Sep 2022 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/git/troubleshooting/how-to-solve-the-error-git-fatal-branch-rename-failed/</guid><description><![CDATA[<p>Since Github started using the name of it&rsquo;s main branch as <code>main</code>, when you create a new repository with <code>git init</code>, it is misaligned with this new standard. Your repository is created with the main branch name <code>Master</code>.</p>
<p>The following example shows the commands suggested by Github to push files in the new repository, from a repository already existing in yours machine:</p>
<div class="highlight"><pre tabindex="0" class="chroma"><code class="language-bash" data-lang="bash"><span class="line"><span class="cl">git remote add origin git@github.com:nunomazer/my-new-repo.git
</span></span><span class="line"><span class="cl">git branch -M main
</span></span><span class="line"><span class="cl">git push -u origin main
</span></span></code></pre></div><p>However, it is common an error message similar to the following to be shown after the <code>git branch -M main</code> command:</p>]]></description></item><item><title>Web and Mobile Software Development Environment in Linux</title><link>https://mazer.dev/en/blog/posts/software-development-environment-in-linux/</link><pubDate>Tue, 19 Jul 2022 19:33:23 +0000</pubDate><guid>https://mazer.dev/en/blog/posts/software-development-environment-in-linux/</guid><description><![CDATA[<p>If you want to set up the <s>Best</s> environment for software development in <a href="https://linuxmint.com/" target="_blank" rel="noopener noreferrer">Linux Mint<i class="fas fa-external-link-square-alt ms-1"></i></a> (or Ubuntu and other Debian based distros), this is the right article for this.</p>
<p>Every software developer organizes their development environment for programming using a mix of technologies and tools to use to program, improve productivity and that has their personal preferences.</p>
<p>In this post I&rsquo;ll show you how I organize my development environment, starting telling you that there is no best but the most appropriate development environment.Here I show <s>the</s> my best operating system configuration, programming and other tools according to my context, but it can help you in yours.</p>]]></description></item><item><title>How to fix error: src refspec main does not match any in Git</title><link>https://mazer.dev/en/git/troubleshooting/error-src-refspec-main-does-not-match-any-git/</link><pubDate>Sat, 18 Jun 2022 22:07:16 +0000</pubDate><guid>https://mazer.dev/en/git/troubleshooting/error-src-refspec-main-does-not-match-any-git/</guid><description><![CDATA[<p>The error message: <strong>error: src refspec main does not match any</strong> happens for some common causes, most notably when starting a new repository for a project.</p>
<p>A second line of message with the text: <strong>error: failed to push some refs to github.com:nunomazer/my-repository.git</strong> may also appear in the stack error.</p>
<p>You can also get the error message: <strong>error: src refspec master does not match any</strong>, if your branch is <code>master</code> and not <code>main</code>.</p>]]></description><enclosure url="https://mazer.dev/en/git/troubleshooting/error-src-refspec-main-does-not-match-any-git/featured-git-error-refspec.webp" length="46468" type="image/webp"/></item><item><title>Git quick tip: Git checkout of specific files from another branch</title><link>https://mazer.dev/en/git/tips/git-dica-rapida-git-checkout-de-arquivos-especificos-de-outra-branch/</link><pubDate>Tue, 07 Jun 2022 01:27:09 +0000</pubDate><guid>https://mazer.dev/en/git/tips/git-dica-rapida-git-checkout-de-arquivos-especificos-de-outra-branch/</guid><description><![CDATA[<p>The <code>git checkout</code> command can be used to update specific files or directories in your work tree with those of another branch (<a href="/en/diferenca-tag-branch-git/"><em>branch</em></a>), without merging the entire branch.</p>
<p>This can be useful when working with various resource branches (<em>FEATURE BRANCHS</em>) or use Github Pages to generate a static design site.</p>
<p>The manual page of <a href="https://git-scm.com/docs/git-checkout/pt_BR" target="_blank" rel="noreferrer noopener">Git Checkout</a> describes how the Git Checkout command is not useful just to switch between branches.</p>]]></description></item><item><title>Creating a basic README for your profile at Github</title><link>https://mazer.dev/en/git/github/creating-basic-readme-for-github-profile/</link><pubDate>Sun, 06 Mar 2022 01:24:17 +0000</pubDate><guid>https://mazer.dev/en/git/github/creating-basic-readme-for-github-profile/</guid><description><![CDATA[<p>Customize the README of your profile at Github, leave your business card as developer with <strong>your personal touch</strong> and increase the visibility and clarity of your technical position in the software development area.</p>

<h2 id="what-is-readme" data-numberify>What is README<a class="anchor ms-1" href="#what-is-readme"></a></h2>
<p>A README file is often the first element that a visitor will see when accessing your repository.</p>
<p>Usually it includes information about:</p>
<ul>
<li>What is the project scope</li>
<li>Why the project is useful</li>
<li>How users can start using the project</li>
<li>Where users can get help with their project</li>
<li>Who maintains and contributes to the project</li>
</ul>
<p>However, they are not limited to this, what information will be available is to you to choose.</p>]]></description></item><item><title>GIT - Semantic Commits</title><link>https://mazer.dev/en/git/best-practices/git-semantic-commits/</link><pubDate>Fri, 26 Nov 2021 01:40:21 +0000</pubDate><guid>https://mazer.dev/en/git/best-practices/git-semantic-commits/</guid><description><![CDATA[<h2 id="what-are-semantic-commits-or-conventional-commits" data-numberify>What are “semantic commits” or “conventional commits”<a class="anchor ms-1" href="#what-are-semantic-commits-or-conventional-commits"></a></h2>
<p><strong>Semantic Commits</strong>, also known as <strong>conventional commits</strong>, are the best way to document your implementation of applications, as you check context to the management of change of your source code. Semantic commits are considered good practice in the use of GIT as much as other VCs (code versioning systems).</p>

<h2 id="why-to-use-semantic-commits" data-numberify>Why to use semantic commits<a class="anchor ms-1" href="#why-to-use-semantic-commits"></a></h2>
<p>You should write in a GIT commit message not only what you have done, but also specifying <strong>WHY</strong> you have done that.</p>]]></description><enclosure url="https://mazer.dev/en/git/best-practices/git-semantic-commits/featured-conventional-commit.webp" length="52794" type="image/webp"/></item><item><title>How to resolve slow Git conections with SSH in Github, Gitlab or Bitbucket</title><link>https://mazer.dev/en/git/troubleshooting/how-to-fix-slow-ssh-git-with-github-gitlab-bitbucket/</link><pubDate>Wed, 17 Nov 2021 19:13:09 +0000</pubDate><guid>https://mazer.dev/en/git/troubleshooting/how-to-fix-slow-ssh-git-with-github-gitlab-bitbucket/</guid><description><![CDATA[<p>To fix push and pull slow <a href="/en/git/">GIT commands</a>, when we are using <code>SSH</code> keys with the Github, Gitlab and Bitbucket repository services, you need to change the IP version setting used.</p>
<p>I allways use the <a href="/en/http/http-protocol-overview/">HTTPS</a> connections of the source codes repository services, especially for the practicality of using services on any machine without the need to create SSH keys to the GIT connection.</p>
<p>However, the connection speed has become a problem, especially after Github and Bitbucket forcing interaction with their repositories through SSH keys.</p>]]></description></item><item><title>How to fix Git fatal error: refusing to merge unrelated histories</title><link>https://mazer.dev/en/git/troubleshooting/how-to-fix-git-fatal-error-refusing-to-merge-unrelated-histories/</link><pubDate>Fri, 24 Sep 2021 22:25:05 +0000</pubDate><guid>https://mazer.dev/en/git/troubleshooting/how-to-fix-git-fatal-error-refusing-to-merge-unrelated-histories/</guid><description><![CDATA[<p>The error <strong>fatal: refusing to merge unrelated histories</strong> appears when trying to make the forward merge of projects that have different GIT histories lines. Since the release <a href="https://github.com/git/git/blob/master/documentation/relnotes/2.9.0.TXT#L58-l68" target="_blank" rel="noreferrer Noopener">2.9.0 </a> Git does not allow this operation.</p>
<p>The error <code>fatal: refusing to merge unrelated histories</code> usually happens when you try to make the <code>git pull</code> of a remote repository, but your local repository has a history of commites, branches, etc., unlike what is in the remote repository.</p>]]></description></item><item><title>Installing Git on Windows, Linux and MacOS</title><link>https://mazer.dev/en/git/introduction/installing-git-windows-linux-macos/</link><pubDate>Mon, 06 Sep 2021 22:40:43 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/installing-git-windows-linux-macos/</guid><description><![CDATA[<p>The <a href="/en/controle-de-versao-o-que-e/">software versioning system</a> Git is not installed by default on Linux, Windows, and MacOS operating systems.</p>
<p>Even if Git has already been installed, it&rsquo;s a good idea to update to the latest version.</p>
<p>Each system has a different way to perform the installation, and by default, after installation, Git commands are available through the command line or terminal console. You can install it as a package or through another installer, or even download the source code and compile it.</p>]]></description></item><item><title>Open data repositories for developers</title><link>https://mazer.dev/en/blog/posts/open-data-repositories-for-developers/</link><pubDate>Thu, 02 Sep 2021 00:00:00 +0000</pubDate><guid>https://mazer.dev/en/blog/posts/open-data-repositories-for-developers/</guid><description><![CDATA[<h2 id="awesome-data-table-references" data-numberify>Awesome Data Table References<a class="anchor ms-1" href="#awesome-data-table-references"></a></h2>
<p>Awesome Data Table References is a repository of my responsibility, where I curate references to open data tables from Brazilian and world institutions.</p>
<p>Whenever it is necessary to create a field of choice of municipalities, Brazilian states, search for zip code, identification by race or color, developers find themselves by building this data manually, often with various codes of base registration tables.</p>
<p>Currently the repository provides data files to download in original CSV, XLS, SDG, XML or JSON versions.</p>]]></description><enclosure url="https://mazer.dev/en/blog/posts/open-data-repositories-for-developers/featured-dados-brasil.webp" length="117522" type="image/webp"/></item><item><title>What is Git</title><link>https://mazer.dev/en/git/introduction/what-is-git/</link><pubDate>Mon, 23 Aug 2021 18:15:59 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/what-is-git/</guid><description><![CDATA[<p>Do you know the general concept and you know what Git is? Git is by far the most commonly used modern version control system in the world today?</p>
<p>In the introduction of this material you will understand GIT conceptually, its characteristics, and in the articles that talk about <a href="%22en/git/introduction/versionamento/%22">Software Version</a>, you will understand why it is necessary to apply in the software development process, being the tool that allows you to apply all this concepts.</p>]]></description></item><item><title>Temporary cache of GIT credentials - Username and Password</title><link>https://mazer.dev/en/git/tips/temporary-cache-of-git-credentials-username-and-password/</link><pubDate>Thu, 19 Aug 2021 22:37:53 +0000</pubDate><guid>https://mazer.dev/en/git/tips/temporary-cache-of-git-credentials-username-and-password/</guid><description><![CDATA[<p>There are situations where you need to work with a <a href="/en/git/">GIT</a> repository  using <a href="/en/http/http-protocol-overview/">HTTPS protocol</a>
and
cannot permanently store user credentials in the local configuration. One solution is to store credentials in a temporary cache (username and password) for a limited time.</p>
<p>The <code>git-credential-cache</code> option is what we will use to temporarily store passwords in <strong>memory</strong>.</p>
<blockquote>
<p>See also how to define the author of a GIT command for a single command execution in this <a href="/en/git/tips/set-author-for-a-specific-git-command/">Set the author for a specific command</a>, or <a href="../como-configurar-username-e-email-por-projeto-com-git/">How to configure username and email by project with GIT</a>.</p>]]></description></item><item><title>Set author for a specific command in GIT</title><link>https://mazer.dev/en/git/tips/set-author-for-a-specific-git-command/</link><pubDate>Wed, 24 Feb 2021 15:55:00 +0000</pubDate><guid>https://mazer.dev/en/git/tips/set-author-for-a-specific-git-command/</guid><description><![CDATA[<p>Occasionally when you are working on a remote server, development environment or <em>stage</em>, it is not uncommon to make changes and need to run a <code>commit</code> or <code>stash</code> command with your author name.</p>
<p>However, these environments are not always configured, or, as a good practice, should not have a single author configured in Git globally, or sometimes you are in an environment of another configured author.</p>
<p>To identify yourself in the desired action, without having to change the global GIT configuration, you can pass the author and email to that specific command in the execution line.</p>]]></description></item><item><title>Basic Git</title><link>https://mazer.dev/en/git/introduction/basic-git/</link><pubDate>Wed, 12 Aug 2020 11:10:00 +0000</pubDate><guid>https://mazer.dev/en/git/introduction/basic-git/</guid><description><![CDATA[<p>In this article I present an overall and introductory view of the <a href="/o-what-e-git/">GIT</a> versioning system software, to help you start the source code version management with it.</p>
<p>Git is the primary system for source code and software project management as a service (source code repositories) such as <a href="https://github.com/" target="_blank" rel="noopener noreferrer">Github<i class="fas fa-external-link-square-alt ms-1"></i></a>, <a href="https://gitlab.com/" target="_blank" rel="noopener noreferrer">Gitlab<i class="fas fa-external-link-square-alt ms-1"></i></a> and <a href="https://bitbucket.com/" target="_blank" rel="noopener noreferrer">Bitbucket<i class="fas fa-external-link-square-alt ms-1"></i></a>.</p>
<p>Before we start, first of all, can you answer the following question: What is &ldquo;<a href="/control-of-o-what-and/">Versioning Control</a>&rdquo;, or what is &ldquo;<a href="/o-what-and-goer-coding-source/">Software Versioning</a>&rdquo;?</p>]]></description></item></channel></rss>