<?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: Iridium Cao</title>
    <description>The latest articles on DEV Community by Iridium Cao (@iridiumcao).</description>
    <link>https://dev.to/iridiumcao</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%2F350451%2F4156817a-8f49-4b0e-ab19-e70517b69b6c.jpeg</url>
      <title>DEV Community: Iridium Cao</title>
      <link>https://dev.to/iridiumcao</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iridiumcao"/>
    <language>en</language>
    <item>
      <title>Install git 2 on CentOS7</title>
      <dc:creator>Iridium Cao</dc:creator>
      <pubDate>Sun, 31 May 2020 08:36:35 +0000</pubDate>
      <link>https://dev.to/iridiumcao/install-git-2-on-centos7-2bej</link>
      <guid>https://dev.to/iridiumcao/install-git-2-on-centos7-2bej</guid>
      <description>&lt;p&gt;The default git version is 1.18, how to upgrade it to git 2?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yum install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

sudo yum remove git*

sudo yum -y install  git2u-all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;OK, it's done. Check the version now:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ git --version
git version 2.16.6
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Ref: &lt;a href="https://ius.io/setup"&gt;https://ius.io/setup&lt;/a&gt;&lt;br&gt;
&lt;a href="https://computingforgeeks.com/how-to-install-latest-version-of-git-git-2-x-on-centos-7/"&gt;https://computingforgeeks.com/how-to-install-latest-version-of-git-git-2-x-on-centos-7/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>centos7</category>
    </item>
    <item>
      <title>How to check if a git branch exists in the local/remote repository?</title>
      <dc:creator>Iridium Cao</dc:creator>
      <pubDate>Sun, 22 Mar 2020 13:11:04 +0000</pubDate>
      <link>https://dev.to/iridiumcao/how-to-check-if-a-git-branch-exists-in-the-local-remote-repository-3gkd</link>
      <guid>https://dev.to/iridiumcao/how-to-check-if-a-git-branch-exists-in-the-local-remote-repository-3gkd</guid>
      <description>&lt;h3&gt;
  
  
  1. To check the branch in the local repository
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Local:
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists
# test if the branch is in the local repository.
# return 1 if the branch exists in the local, or 0 if not.
function is_in_local() {
    local branch=${1}
    local existed_in_local=$(git branch --list ${branch})

    if [[ -z ${existed_in_local} ]]; then
        echo 0
    else
        echo 1
    fi
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  2. To check the branch in the remote repository
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Remote:
# Ref: https://stackoverflow.com/questions/8223906/how-to-check-if-remote-branch-exists-on-a-given-remote-repository
# test if the branch is in the remote repository.
# return 1 if its remote branch exists, or 0 if not.
function is_in_remote() {
    local branch=${1}
    local existed_in_remote=$(git ls-remote --heads origin ${branch})

    if [[ -z ${existed_in_remote} ]]; then
        echo 0
    else
        echo 1
    fi
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;gits URL: &lt;a href="https://gist.github.com/iridiumcao/714d3d0a9137ce614c26e4e10d185291"&gt;https://gist.github.com/iridiumcao/714d3d0a9137ce614c26e4e10d185291&lt;/a&gt;&lt;/p&gt;

</description>
      <category>git</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
