<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Paulo Lima</title>
    <description>The latest articles on DEV Community by Paulo Lima (@paulolimadev).</description>
    <link>https://dev.to/paulolimadev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1149274%2F663310f7-9d85-4ddb-ab59-e2595265aade.png</url>
      <title>DEV Community: Paulo Lima</title>
      <link>https://dev.to/paulolimadev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/paulolimadev"/>
    <language>en</language>
    <item>
      <title>Git Mastery: Beginner’s Guide + Cheat Sheet</title>
      <dc:creator>Paulo Lima</dc:creator>
      <pubDate>Wed, 13 Sep 2023 01:06:52 +0000</pubDate>
      <link>https://dev.to/paulolimadev/git-mastery-beginners-guide-cheat-sheet-40o6</link>
      <guid>https://dev.to/paulolimadev/git-mastery-beginners-guide-cheat-sheet-40o6</guid>
      <description>&lt;h2&gt;
  
  
  Getting Started:
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Initialize a Git Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To start tracking your project with Git, navigate to your project folder and run:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Configure Your Identity:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set your name and email address for your Git commits:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git config - global user.name &lt;span class="s2"&gt;"Your Name"&lt;/span&gt;
git config - global user.email &lt;span class="s2"&gt;"your.email@example.com"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Basic Workflow:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check Repository Status:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See the current status of your repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;State Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add changes to the staging area (preparing them for a commit):
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add filename &lt;span class="c"&gt;# To stage a specific file&lt;/span&gt;
git add &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="c"&gt;# To stage all changes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Commit Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new commit with a message:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; “Your commit message”
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;View Commit History:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;See a list of previous commits:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Branches:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a New Branch:&lt;/strong&gt;&lt;br&gt;
— Create a new branch for your work:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Switch to a Branch:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Change to a different branch:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Create and Switch to a New Branch:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combine branch creation and checkout in one step:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;List Branches:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;View a list of all branches in your repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Delete a Branch (Locally):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remove a branch that is no longer needed:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Merging:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Merge Changes from Another Branch:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Combine changes from one branch into another:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git merge &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Remote Repositories:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Clone a Remote Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start working with an existing repository hosted on a remote server:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &lt;span class="o"&gt;[&lt;/span&gt;repository_url]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Add a Remote Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Connect your local repository to a remote server:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote add &lt;span class="o"&gt;[&lt;/span&gt;remote_name] &lt;span class="o"&gt;[&lt;/span&gt;repository_url]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Pull Changes from a Remote Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update your local repository with changes from the remote:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull &lt;span class="o"&gt;[&lt;/span&gt;remote_name] &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Push Changes to a Remote Repository:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Share your local changes with the remote repository:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="o"&gt;[&lt;/span&gt;remote_name] &lt;span class="o"&gt;[&lt;/span&gt;branch_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember that Git offers many more features and commands, but these basics should help you get started with version control. As you become more comfortable with Git, you can explore more advanced concepts and commands.&lt;/p&gt;

</description>
      <category>gettingstartedwithgit</category>
      <category>essentialgitcommands</category>
      <category>branchingandmerging</category>
      <category>git</category>
    </item>
  </channel>
</rss>
