<?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: Maaz Ahmed Khan</title>
    <description>The latest articles on DEV Community by Maaz Ahmed Khan (@maazakn).</description>
    <link>https://dev.to/maazakn</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%2F1023942%2Fcde8a8c8-3d05-4bb7-aff1-313237393bd6.png</url>
      <title>DEV Community: Maaz Ahmed Khan</title>
      <link>https://dev.to/maazakn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/maazakn"/>
    <language>en</language>
    <item>
      <title>💬 Changing Git Config for Previous Commits🚚</title>
      <dc:creator>Maaz Ahmed Khan</dc:creator>
      <pubDate>Fri, 07 Feb 2025 11:47:12 +0000</pubDate>
      <link>https://dev.to/maazakn/changing-git-config-for-previous-commits-5165</link>
      <guid>https://dev.to/maazakn/changing-git-config-for-previous-commits-5165</guid>
      <description>&lt;p&gt;Sometimes, you need to modify the author's name or email address for earlier commits. This might happen if you use the wrong email address, or perhaps you want to update your identity for privacy or other reasons. Fortunately, Git allows you to easily change the author name and email for previous commits using the filter-branch command.&lt;/p&gt;

&lt;p&gt;The filter-branch command rewrites Git history by applying a filter to each commit. In this article, we’ll walk through how to change the author name and email for previous commits.&lt;/p&gt;

&lt;h2&gt;
  
  
  To Update the Author and Email for Specific Commits:
&lt;/h2&gt;

&lt;p&gt;If you need to change the author and email for specific commits (e.g., replacing one old email with a new one), you can use the following command in your Git Bash shell:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git filter-branch --commit-filter '
  if [ "$GIT_AUTHOR_EMAIL" = "oldEmail.com" ];
  then
    GIT_AUTHOR_NAME="newAuthorName";
    GIT_AUTHOR_EMAIL="newAuthorEmail.com"; 
    git commit-tree "$@";
  else
    git commit-tree "$@";
  fi
' HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  To Update the Author and Email for All Commits:
&lt;/h2&gt;

&lt;p&gt;If your goal is to replace the author name and email for every commit in the repository with a specific author name and email, you can use this command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git filter-branch --commit-filter '
  GIT_AUTHOR_NAME="newAuthor Name"; 
  GIT_AUTHOR_EMAIL="newAuthorEmail.com";
  GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME";
  GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL";
  git commit-tree "$@";
' -- --all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Important Notes:
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;These commands should be executed in your Git Bash shell, which is available if you're using Git for Windows. Make sure you're in the root directory of your Git repository when running the command.&lt;/li&gt;
&lt;li&gt;If you've already pushed commits to a remote repository, you'll need to force-push the changes to update the remote history:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git push --force --tags
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Force-pushing rewrites the commit history. It can disrupt the work of other collaborators, so make sure you communicate with your team before doing so. It's often a good idea to only perform this operation on repositories that are not publicly available or on those where you are the only contributor.&lt;/p&gt;

&lt;p&gt;By using these &lt;strong&gt;git filter-branch&lt;/strong&gt; commands, you can effectively change the author name and email for past commits, whether for specific commits or all commits in your repository.&lt;/p&gt;

</description>
      <category>git</category>
      <category>gittips</category>
      <category>gittricks</category>
      <category>githistory</category>
    </item>
    <item>
      <title>A Guide to Effortlessly Use SVGs in Next Js Projects</title>
      <dc:creator>Maaz Ahmed Khan</dc:creator>
      <pubDate>Tue, 30 Apr 2024 08:42:15 +0000</pubDate>
      <link>https://dev.to/maazakn/a-guide-to-effortlessly-use-svgs-in-next-js-projects-2ean</link>
      <guid>https://dev.to/maazakn/a-guide-to-effortlessly-use-svgs-in-next-js-projects-2ean</guid>
      <description>&lt;p&gt;In the world of web development, Scalable Vector Graphics (SVGs) have become a staple for creating scalable, high-quality graphics that look great on any screen size. However, integrating SVGs into React projects can sometimes be a hassle.&lt;/p&gt;

&lt;p&gt;SVGR is a command-line tool and webpack loader that transforms SVG files into React components. This means that instead of dealing with cumbersome SVG syntax directly in your code, you can simply import SVG files as React components and use them just like any other React component.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install @svgr/webpack --save-dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, configure SVGR in your Next.js project. You can do this by adding SVGR to your webpack configuration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const nextConfig = {
  webpack(config) {
    // Grab the existing rule that handles SVG imports
    const fileLoaderRule = config.module.rules.find(rule =&amp;gt; rule.test?.test?.('.svg'));

    config.module.rules.push(
      // Reapply the existing rule, but only for svg imports ending in ?url
      {
        ...fileLoaderRule,
        test: /\.svg$/i,
        resourceQuery: /url/ // *.svg?url
      },
      // Convert all other *.svg imports to React components
      {
        test: /\.svg$/i,
        issuer: fileLoaderRule.issuer,
        resourceQuery: { not: [...fileLoaderRule.resourceQuery.not, /url/] }, // exclude if *.svg?url
        use: ['@svgr/webpack']
      }
    );

    // Modify the file loader rule to ignore *.svg, since we have it handled now.
    fileLoaderRule.exclude = /\.svg$/i;

    return config;
  },
};

export default nextConfig;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that SVGR is set up, you can start using it to import SVGs as React components directly into your Next.js project. Simply import the SVG file and use it like any other React component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import MySvgIcon from '../path/to/MySvgIcon.svg';

const MyComponent = () =&amp;gt; {
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;MySvgIcon /&amp;gt;
      {/* Other JSX */}
    &amp;lt;/div&amp;gt;
  );
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SVGR provides various options for customizing the generated React components. You can configure options such as dimensions, file naming, and component naming by passing options to SVGR through webpack configuration or directly in the import statement.&lt;/p&gt;

&lt;p&gt;For more, checkout: &lt;a href="https://react-svgr.com/docs/getting-started/"&gt;https://react-svgr.com/docs/getting-started/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy coding!&lt;/p&gt;

</description>
      <category>react</category>
      <category>nextjs</category>
      <category>svg</category>
      <category>svgr</category>
    </item>
    <item>
      <title>🔐 Enhancing Security of React Apps</title>
      <dc:creator>Maaz Ahmed Khan</dc:creator>
      <pubDate>Sat, 25 Nov 2023 12:33:52 +0000</pubDate>
      <link>https://dev.to/maazakn/enhancing-security-of-react-apps-4cfn</link>
      <guid>https://dev.to/maazakn/enhancing-security-of-react-apps-4cfn</guid>
      <description>&lt;p&gt;React, one of the most popular JavaScript libraries, is widely used to build dynamic and interactive web applications. But did you know that there's a powerful feature called GENERATE_SOURCEMAP that can play a significant role in securing your React apps?&lt;/p&gt;

&lt;p&gt;GENERATE_SOURCEMAP=false is a setting that can be employed during the build process of your React app. It's a simple yet effective way to prevent the generation of source maps in the production build. While source maps are incredibly helpful for debugging in development, they also provide valuable insights to potential attackers in a production environment. As a result, the minified and transpiled code becomes less accessible to those with malicious intent. This security measure minimizes the exposure of your original source code, reducing the risk of code theft, reverse engineering, and vulnerability exploitation.&lt;/p&gt;

&lt;p&gt;🚀 Implementation:&lt;/p&gt;

&lt;p&gt;Implementing GENERATE_SOURCEMAP=false is straightforward. Set the environment variable to false during your build process, and your build tools will handle the rest.&lt;/p&gt;

</description>
      <category>react</category>
      <category>security</category>
      <category>sourcecode</category>
      <category>developer</category>
    </item>
    <item>
      <title>Exciting News for Node.js Developers!</title>
      <dc:creator>Maaz Ahmed Khan</dc:creator>
      <pubDate>Sat, 25 Nov 2023 12:08:47 +0000</pubDate>
      <link>https://dev.to/maazakn/new-post-3dnd</link>
      <guid>https://dev.to/maazakn/new-post-3dnd</guid>
      <description>&lt;p&gt;📣 One standout feature is the built-in support for .env files. Say goodbye to external packages Node.js now effortlessly loads your environment variables from a .env file. 🔄&lt;/p&gt;

&lt;p&gt;Here's how to make the most of it:&lt;/p&gt;

&lt;p&gt;1️⃣ Start by creating a .env file in your project's root directory.&lt;/p&gt;

&lt;p&gt;2️⃣ To harness the power of this new feature, simply run your Node.js application with the '--env-file' flag like this:&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>web</category>
    </item>
  </channel>
</rss>
