<?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: Farhad F.</title>
    <description>The latest articles on DEV Community by Farhad F. (@farhadf).</description>
    <link>https://dev.to/farhadf</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%2F14760%2Fc2a5b42e-869a-4793-976e-9ab8620d4f22.jpeg</url>
      <title>DEV Community: Farhad F.</title>
      <link>https://dev.to/farhadf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/farhadf"/>
    <language>en</language>
    <item>
      <title>Git Survival Kit - Part 2</title>
      <dc:creator>Farhad F.</dc:creator>
      <pubDate>Tue, 11 Jan 2022 03:12:30 +0000</pubDate>
      <link>https://dev.to/farhadf/git-survival-kit-part-2-bb2</link>
      <guid>https://dev.to/farhadf/git-survival-kit-part-2-bb2</guid>
      <description>&lt;p&gt;This is the second part of my git survival kit series, a collection of easy-to-learn and vital commands for day-to-day git operations for everyone. Even if you're new to git, knowing these commands will definitely help you become more productive and solve your mistakes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. display the list of branches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;local branches: &lt;code&gt;git branch&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;remote branches: &lt;code&gt;git branch -r&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. display current repository configurations&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git config -l&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. delete tag from the local repository&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git tag --delete tagname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. delete tag from the remote repository&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git push --delete origin tagname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. see which commit a tag points to&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git rev-parse tagname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. revert branch history to a specific tag, discarding all changes after the tag&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git reset --hard tagname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. revert branch history to a specific tag, keeping all changes after the tag in the staging area&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git reset --soft tagname&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. filtering history of commits in date ranges using since and until options&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git log --since='yesterday'&lt;/code&gt;&lt;br&gt;
and &lt;br&gt;
&lt;code&gt;git log --since="1 week ago" --until="yesterday"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. showing commit history with summary of changes made in each commit&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git whatchanged&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;also, the since and until options can be used to filter history&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git whatchanged --since='2 weeks ago' --until='2 days ago'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. see the changes to a file in a commit&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git show commit_hash -- file_name&lt;/code&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Git Survival Kit - Part 1</title>
      <dc:creator>Farhad F.</dc:creator>
      <pubDate>Mon, 10 Jan 2022 00:42:36 +0000</pubDate>
      <link>https://dev.to/farhadf/git-survival-kit-part-1-1bfk</link>
      <guid>https://dev.to/farhadf/git-survival-kit-part-1-1bfk</guid>
      <description>&lt;p&gt;&lt;a href="https://dev.to/farhadfaghihi/git-survival-kit-part-2-bb2"&gt;Read Part 2&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the life of every developer regardless of experience level, comes a day when she needs to get out of or resolve an awkward git situation. In this series, I'm going to share some simple yet life-saving git commands that are both easy to learn and vital to your day-to-day version control ops.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. undo the first commit&lt;/strong&gt; ( assuming there is only one commit in the history)&lt;br&gt;
&lt;code&gt;git update-ref -d HEAD&lt;/code&gt;  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. undo the last (n) commits and return the changed files to staging area&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git reset --soft HEAD~n&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. print the number of commits on all branches grouped by authors&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git shortlog -s -n --all&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;p.s - yes Jayson, that's how I found out that I've done more commits than you. Take that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. undo a pushed commit in the remote repository, on master branch&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git push origin +{commit-hash}^:master&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. See all the upstream repository urls, where you're 'pushing' your code.&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git remote -v&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. remove a file from the staging area&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git reset &amp;lt;file_name&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. remove all files inside a folder from the staging area&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git reset &amp;lt;folder_name&amp;gt;/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;8. ignore changes to already tracked files&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git update-index --assume-unchanged &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;another alternative :&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git update-index --skip-worktree &amp;lt;file&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/a/13631525/2450855"&gt;read more on assume-unchanged vs. skip-worktree&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;9. undo last tip: start tracking files again&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git update-index --no-assume-unchanged [&amp;lt;file&amp;gt; ...]&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;10. show list of tags, sorted by date descendingly&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;git tag --sort=-creatordate&lt;/code&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
