<?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: KOTESWAR RAO MEESALA</title>
    <description>The latest articles on DEV Community by KOTESWAR RAO MEESALA (@koteswar375).</description>
    <link>https://dev.to/koteswar375</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%2F283127%2Fdee4c0cc-454c-4a3b-a9e9-2cfd7256d785.png</url>
      <title>DEV Community: KOTESWAR RAO MEESALA</title>
      <link>https://dev.to/koteswar375</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/koteswar375"/>
    <language>en</language>
    <item>
      <title>How do I discard or undo changes in Git</title>
      <dc:creator>KOTESWAR RAO MEESALA</dc:creator>
      <pubDate>Mon, 09 Dec 2019 18:38:48 +0000</pubDate>
      <link>https://dev.to/koteswar375/how-do-i-discard-or-undo-changes-in-git-5d3k</link>
      <guid>https://dev.to/koteswar375/how-do-i-discard-or-undo-changes-in-git-5d3k</guid>
      <description>&lt;p&gt;Undoing changes is a most common scenario when using Git and one that everyone comes across. There are ways to undo changes that are committed locally(reset) and undo changes that are published remotely(revert). I will cover commands used to undo things that are committed locally. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7FALV7GE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1wyuhued3iyovmmzmqg9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7FALV7GE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/1wyuhued3iyovmmzmqg9.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Git reset:
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;git reset&lt;/code&gt; is the command that one needs to use to reset the changes, whether those changes are in working directory, staging area or the ref HEAD points to. By default, HEAD always points to the latest snapshot in a particular branch. Git reset command comes with few options to move this HEAD to point to the commit you want.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;git reset --soft HEAD~1&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;This tells git to move what the branch &lt;code&gt;HEAD&lt;/code&gt; points to and stop there. No matter what form of reset with a commit you invoke, this is the first thing it will always try to do. It doesn't go further resetting staging area and working copy. Leave them as they were. Here, it moves the &lt;code&gt;HEAD&lt;/code&gt; to its parent commit(one commit before it). &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;git reset --mixed HEAD~1&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;This is the default. This is same as &lt;code&gt;git reset HEAD~1&lt;/code&gt;. Now, git proceeds to make changes to index and update its contents so that it looks like what &lt;code&gt;HEAD&lt;/code&gt; points to. It means, it unstages everything and this is where the command will stop. It will not proceed to overwrite changes in working copy. Now, the HEAD, and the index are in sync.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;code&gt;git reset --hard HEAD~1&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;This resets everything. It moves the HEAD, updates index and rolls back changes to working directory. Now, all the players are in sync. You undid your last commit, the git add and git commit commands, and all the work you did in your working directory.&lt;/p&gt;

&lt;p&gt;P.S Instead of passing a commit hashcode, one can pass a file path to reset. &lt;br&gt;
Eg: &lt;code&gt;git reset index.js&lt;/code&gt;&lt;br&gt;
This unstages all the changes in that file. This is the output of the &lt;code&gt;git status&lt;/code&gt; command that suggests you to run this to unstage a file. &lt;/p&gt;

&lt;p&gt;That's it !! You can start using based on your use-case and be careful with &lt;code&gt;git reset --hard&lt;/code&gt; as it will rmove the changes from working directory as well.&lt;/p&gt;

</description>
      <category>git</category>
      <category>undo</category>
      <category>reset</category>
      <category>versioncontrol</category>
    </item>
    <item>
      <title>Get the list of all files with specific extension in C#</title>
      <dc:creator>KOTESWAR RAO MEESALA</dc:creator>
      <pubDate>Mon, 02 Dec 2019 13:11:24 +0000</pubDate>
      <link>https://dev.to/koteswar375/get-the-list-of-all-files-with-specific-extension-in-c-3bha</link>
      <guid>https://dev.to/koteswar375/get-the-list-of-all-files-with-specific-extension-in-c-3bha</guid>
      <description>&lt;p&gt;One might have come across a situation to fetch all the files under a given directory and do something with those files. In this article, we will look at how it can be done with a single line of code in C#. Later, I'm going to mention how did I stumble upon such a use case.&lt;/p&gt;

&lt;p&gt;We will be using &lt;code&gt;GetFiles&lt;/code&gt; static method available on &lt;a href="https://docs.microsoft.com/en-us/dotnet/api/system.io.directory.getfiles?redirectedfrom=MSDN&amp;amp;view=netframework-4.8#System_IO_Directory_GetFiles_System_String_System_String_" rel="noopener noreferrer"&gt;Directory&lt;/a&gt; class under System.IO namespace. This method has three overloads. We will use the one that takes three arguments.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A string that takes an absolute or relative path to the directory&lt;/li&gt;
&lt;li&gt;A string that takes a search pattern to match the files against &lt;/li&gt;
&lt;li&gt;A search option  to search recursively or only the current directory&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fptqnwhtbxnxhh94vxpyg.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fthepracticaldev.s3.amazonaws.com%2Fi%2Fptqnwhtbxnxhh94vxpyg.jpeg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My use case is to search for all the images with a .bmp extension under the specified directory and convert them to jpeg images.&lt;br&gt;
So, the line of code I would use is&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight csharp"&gt;&lt;code&gt;

&lt;span class="n"&gt;Directory&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;@"C:\mydir"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"*.bmp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SearchOption&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AllDirectories&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here, &lt;code&gt;SearchOption&lt;/code&gt; is an enum that contains two fields. &lt;code&gt;AllDirectories&lt;/code&gt; and &lt;code&gt;TopDirectoryOnly&lt;/code&gt;. I guess it's self-explanatory how to use those fields.&lt;br&gt;
Make sure when you are using &lt;code&gt;AllDirectories&lt;/code&gt;, the directory structure do not form a loop.&lt;/p&gt;

&lt;p&gt;That's it!! I hope this article has augmented that knowledge bundle of yours.&lt;/p&gt;

&lt;p&gt;Thank you!! Happy to receive feedback and answer any questions !!&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>fileinfo</category>
      <category>directryinfo</category>
      <category>dotnet</category>
    </item>
  </channel>
</rss>
