<?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: Sharif Ahmed</title>
    <description>The latest articles on DEV Community by Sharif Ahmed (@ahsanphero2022).</description>
    <link>https://dev.to/ahsanphero2022</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%2F1468823%2F98b85eaa-79a5-4146-9de2-2094969112a1.jpg</url>
      <title>DEV Community: Sharif Ahmed</title>
      <link>https://dev.to/ahsanphero2022</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahsanphero2022"/>
    <language>en</language>
    <item>
      <title>Git Rebase vs Git Merge: A Comprehensive Guide</title>
      <dc:creator>Sharif Ahmed</dc:creator>
      <pubDate>Mon, 06 May 2024 12:28:36 +0000</pubDate>
      <link>https://dev.to/ahsanphero2022/git-rebase-vs-git-merge-a-comprehensive-guide-33og</link>
      <guid>https://dev.to/ahsanphero2022/git-rebase-vs-git-merge-a-comprehensive-guide-33og</guid>
      <description>&lt;p&gt;Git, a distributed version control system, offers a variety of ways developers can integrate changes from one branch into another: git merge and git rebase being two of the most commonly used strategies. Understanding the differences, benefits, and best practices of both can greatly enhance your Git workflow efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Git Merge
&lt;/h2&gt;

&lt;p&gt;Think of &lt;code&gt;git merge&lt;/code&gt; as a handshake between two branches. The &lt;code&gt;git merge&lt;/code&gt; command integrates changes from one branch into another. It takes the contents of a source branch and integrates it with the target branch. If the histories of both branches have diverged, Git creates a new merge commit to combine the histories, preserving the history as it happened.&lt;/p&gt;

&lt;p&gt;Consider two branches, &lt;del&gt;feature&lt;/del&gt; and &lt;del&gt;master&lt;/del&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A---B---C feature
 /
D---E---F---G master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Merging &lt;del&gt;feature&lt;/del&gt; into &lt;del&gt;master&lt;/del&gt; would result in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A---B---C feature
 /         \
D---E---F---G---H master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The master branch now includes a new commit H that represents the merge commit, preserving the history of both branches as they happened.&lt;/p&gt;

&lt;h2&gt;
  
  
  Understanding Git Rebase
&lt;/h2&gt;

&lt;p&gt;git rebase is a command that allows you to integrate changes from one branch into another, similar to git merge. But it works in a different way. Let's consider git rebase as a painting process. Imagine the master branch as a wall and the feature branch as an artist. Initially, the master branch (the wall) is painted first. The feature branch (the artist) then comes in and adds their work on top of the master branch's work.&lt;/p&gt;

&lt;p&gt;However, if the original painting (the master branch) is updated, the artist (the feature branch) would temporarily remove their painting, allow the wall to be updated, and then add their painting back on top of the updated wall. This is essentially what happens in git rebase.&lt;/p&gt;

&lt;p&gt;git rebase takes the changes made in the feature branch and reapplies them onto the master branch, effectively creating a new base for the feature branch and rewriting history. This results in a more linear and clean commit history.&lt;/p&gt;

&lt;p&gt;Consider again two branches, feature and master:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A---B---C feature
 /
D---E---F---G master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rebasing feature onto master would give:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D---E---F---G master
             \
              A'---B'---C' feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Commits A, B, and C are reapplied onto master, creating new commits A', B', and C'.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparing Git Merge and Git Rebase
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Benefits and Use Cases
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Preserving History: Git merge preserves history as it happened, including the time and order of all commits, while Git rebase can rewrite and clean up history, making it more linear and comprehensible. This can be beneficial when you want to understand the development process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Conflict Resolution: When merging, conflicts need to be resolved once during the merge commit. However, during a rebase, you may have to resolve conflicts for each commit being reapplied. This can become tedious if many commits have similar conflicts.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Rebase for Local Cleanup: Rebase can be used to clean up local, in-progress features. By periodically performing an interactive rebase, you can ensure each commit in your feature is focused and meaningful.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Merge for Public Commits: Once you have shared your branch with others, it is best practice to use merge. Rebase could potentially rewrite the commit history and create confusion for other developers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Avoid Rebasing Public Branches: Rebasing a public branch that others have based work on is a bad practice as it alters the commit history. This can cause confusion and further conflicts for other developers.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Both git merge and git rebase are powerful tools for integrating changes from one branch into another. They serve different purposes and are used in different scenarios. It's essential to understand the implications of each and choose the right tool for the right situation.&lt;/p&gt;

&lt;p&gt;git merge is great for combining code from two different branches and preserving the exact historical timeline of commits. On the other hand, git rebase is excellent for making your feature branch up to date with the latest code from the master branch, keeping the history of your feature branch clean and making it appear as if the work happened sequentially.&lt;/p&gt;

&lt;p&gt;In both cases, conflicts can arise and need to be resolved manually. But remember, once you've shared your branch with others, it's a best practice to use git merge to avoid rewriting public commit history.&lt;/p&gt;

</description>
      <category>github</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>LocalStack - Mock AWS in local development</title>
      <dc:creator>Sharif Ahmed</dc:creator>
      <pubDate>Mon, 06 May 2024 12:15:29 +0000</pubDate>
      <link>https://dev.to/ahsanphero2022/localstack-mock-aws-in-local-development-229f</link>
      <guid>https://dev.to/ahsanphero2022/localstack-mock-aws-in-local-development-229f</guid>
      <description>&lt;p&gt;Most of us are familiar with Amazon Web Services (AWS) and have probably used their cloud computing services at some point in our careers. AWS is a go-to solution for many developers when it comes to building and deploying applications on the cloud.&lt;/p&gt;

&lt;p&gt;However, working with AWS can come with its challenges, particularly when it comes to testing and development. While AWS offers a wide range of powerful services and tools, navigating through the vast array of options and configuring them correctly can be complex and costly. As AWS provides a pay-as-you-go pricing model, the costs can quickly escalate if resources are not managed effectively while developing and testing. Herein lies the role of LocalStack.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobsv8qvbnm95dv3oko2m.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fobsv8qvbnm95dv3oko2m.jpg" alt="Image description" width="800" height="327"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What is LocalStack?
&lt;/h2&gt;

&lt;p&gt;LocalStack is an open-source project that provides a fully functional local AWS cloud stack. It allows developers to test and develop their applications offline without needing an internet connection or any cloud resources. LocalStack allows developers to emulate the behavior of AWS services such as S3, Lambda, DynamoDB, and more, all within a local environment, eliminating the need for an AWS account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features and Capabilities
&lt;/h2&gt;

&lt;p&gt;Simulation of entire AWS Services: LocalStack enables developers to simulate the entire AWS ecosystem within its local environment.&lt;br&gt;
Offline Development: With LocalStack, developers can work offline without relying on an internet connection or AWS account.&lt;br&gt;
Cost Savings: By simulating AWS services locally, LocalStack eliminates the costs associated with running resources in the cloud.&lt;br&gt;
Easy Setup and Configuration: LocalStack simplifies the setup process with a user-friendly command-line interface (CLI) and APIs.&lt;br&gt;
Realistic Testing Scenarios: By emulating the actual behavior of AWS services, LocalStack allows developers to create realistic testing scenarios. This early identification and resolution of potential issues lead to the development of more robust and reliable applications.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
      <category>aws</category>
    </item>
  </channel>
</rss>
