<?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: Cristian Jonhson Alvarez</title>
    <description>The latest articles on DEV Community by Cristian Jonhson Alvarez (@cristian-jonhson).</description>
    <link>https://dev.to/cristian-jonhson</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1490505%2F7d90a1a0-7c74-40a5-843a-d3b0528050cd.jpg</url>
      <title>DEV Community: Cristian Jonhson Alvarez</title>
      <link>https://dev.to/cristian-jonhson</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/cristian-jonhson"/>
    <language>en</language>
    <item>
      <title>How to Change a Public Repository to Private Using GitHub CLI</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Tue, 30 Jun 2026 21:13:07 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/how-to-change-a-public-repository-to-private-using-github-cli-20fc</link>
      <guid>https://dev.to/cristian-jonhson/how-to-change-a-public-repository-to-private-using-github-cli-20fc</guid>
      <description>&lt;p&gt;When working on personal, academic, or professional projects, we often start a repository as &lt;strong&gt;public&lt;/strong&gt; to share progress, test configurations, or collaborate openly. However, at some point, it may become necessary to protect the code, especially if the project contains business logic, internal configurations, technical documentation, or an architecture that we do not want to expose yet.&lt;/p&gt;

&lt;p&gt;In this article, we will see how to change a repository from &lt;strong&gt;public to private&lt;/strong&gt; using &lt;strong&gt;GitHub CLI (&lt;code&gt;gh&lt;/code&gt;)&lt;/strong&gt;, directly from the terminal.&lt;/p&gt;




&lt;h2&gt;
  
  
  Prerequisite
&lt;/h2&gt;

&lt;p&gt;Before running the commands, you need to have GitHub CLI installed and configured.&lt;/p&gt;

&lt;p&gt;You can check if &lt;code&gt;gh&lt;/code&gt; is installed with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nt"&gt;--version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also verify if you are properly authenticated:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh auth status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are not logged in, you can authenticate with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Important Security Note
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Changing a repository from public to private does not remove any sensitive data that may have already been exposed. If you accidentally published secrets, API keys, tokens, or credentials, rotate them immediately.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Change a Public Repository to Private
&lt;/h2&gt;

&lt;p&gt;The most direct way to change the visibility of a repository using GitHub CLI is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo edit OWNER/REPO &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo edit username/my-repository &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important flag here is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;GitHub requires this flag because changing the visibility of a repository can have consequences, such as affecting forks, stars, watchers, access permissions, or related integrations.&lt;/p&gt;




&lt;h2&gt;
  
  
  Change Visibility from the Local Repository Folder
&lt;/h2&gt;

&lt;p&gt;If you are already inside the project folder and the local repository has its GitHub remote configured, you can run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo edit &lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;my-repository
gh repo edit &lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything goes well, GitHub CLI will show a message like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✓ Edited repository username/my-repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the repository was updated successfully.&lt;/p&gt;




&lt;h2&gt;
  
  
  Verify That the Repository Is Private
&lt;/h2&gt;

&lt;p&gt;After changing the visibility, it is a good practice to verify the repository status.&lt;/p&gt;

&lt;p&gt;To check a specific repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view username/my-repository &lt;span class="nt"&gt;--json&lt;/span&gt; visibility
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The expected response should be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"visibility"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PRIVATE"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also verify it from inside the local project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view &lt;span class="nt"&gt;--json&lt;/span&gt; visibility
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expected result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"visibility"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PRIVATE"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This confirms that the repository is no longer public.&lt;/p&gt;




&lt;h2&gt;
  
  
  Open the Repository in the Browser
&lt;/h2&gt;

&lt;p&gt;You can also open the repository directly from the terminal using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view username/my-repository &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, if you are inside the local project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will open the repository on GitHub in your browser, where you can visually review the configuration.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Happens to Collaborators?
&lt;/h2&gt;

&lt;p&gt;When a repository becomes private, only the following users will have access:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The repository owner&lt;/li&gt;
&lt;li&gt;Manually added collaborators&lt;/li&gt;
&lt;li&gt;Organization members with the corresponding permissions, if applicable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can review the collaborators with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh api repos/username/my-repository/collaborators
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Useful Command Summary
&lt;/h2&gt;

&lt;p&gt;Change a repository to private:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo edit OWNER/REPO &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Change a repository to private from the local folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo edit &lt;span class="nt"&gt;--visibility&lt;/span&gt; private &lt;span class="se"&gt;\&lt;/span&gt;
&lt;span class="nt"&gt;--accept-visibility-change-consequences&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify repository visibility:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view OWNER/REPO &lt;span class="nt"&gt;--json&lt;/span&gt; visibility
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the repository on GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo view OWNER/REPO &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






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

&lt;p&gt;GitHub CLI makes repository management faster and more efficient directly from the terminal. Changing a repository from public to private is a simple task, but it is an important step when you need to protect source code, internal documentation, configuration files, or an unfinished project.&lt;/p&gt;

&lt;p&gt;This workflow is especially useful for projects that are still under development, contain sensitive information, or are not ready to be publicly shared.&lt;/p&gt;

&lt;p&gt;With a single command, you can update the repository visibility and verify the result without leaving the terminal.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>cli</category>
      <category>devops</category>
    </item>
    <item>
      <title>Fixing “release version 17 not supported” on macOS for Spring Boot 3</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Tue, 23 Jun 2026 00:54:51 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/installing-java-17-on-macos-to-run-a-spring-boot-3-api-gle</link>
      <guid>https://dev.to/cristian-jonhson/installing-java-17-on-macos-to-run-a-spring-boot-3-api-gle</guid>
      <description>&lt;p&gt;If you are trying to run a Spring Boot 3 project and Maven throws release version 17 not supported, the problem is usually not your code. Most of the time, Maven is using an older JDK.&lt;/p&gt;

&lt;p&gt;When working with modern &lt;strong&gt;Spring Boot 3&lt;/strong&gt; projects, one of the main requirements is using &lt;strong&gt;Java 17 or higher&lt;/strong&gt;. This may sound simple, but in practice, it is common to run into errors when Maven is still using an older Java version, such as Java 8 or Java 11.&lt;/p&gt;

&lt;p&gt;In this article, we will review a common case: trying to run a Java Spring Boot API and getting the following error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Fatal error compiling: error: release version 17 not supported
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Project context
&lt;/h2&gt;

&lt;p&gt;Let’s assume we are working on a REST API built with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Java 17&lt;/li&gt;
&lt;li&gt;Spring Boot 3&lt;/li&gt;
&lt;li&gt;Maven&lt;/li&gt;
&lt;li&gt;PostgreSQL&lt;/li&gt;
&lt;li&gt;Docker&lt;/li&gt;
&lt;li&gt;macOS Intel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The application can be any typical backend project: a products API, users API, sales system, inventory system, ticketing system, reports API, or an integration service with a database.&lt;/p&gt;

&lt;p&gt;The important point is that the project is configured to compile with Java 17.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;When running the project with Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn clean spring-boot:run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;the following error appears:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile
Fatal error compiling: error: release version 17 not supported
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first, it may look like the problem is in the code or in the &lt;code&gt;pom.xml&lt;/code&gt;. However, in many cases, the real issue is the Java version that Maven is actually using.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking the pom.xml file
&lt;/h2&gt;

&lt;p&gt;In a Spring Boot 3 project, you will usually find a configuration like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;properties&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;java.version&amp;gt;&lt;/span&gt;17&lt;span class="nt"&gt;&amp;lt;/java.version&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/properties&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the project needs to be compiled using Java 17.&lt;/p&gt;

&lt;p&gt;You may also see a Spring Boot 3 parent like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight xml"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;parent&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;groupId&amp;gt;&lt;/span&gt;org.springframework.boot&lt;span class="nt"&gt;&amp;lt;/groupId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;artifactId&amp;gt;&lt;/span&gt;spring-boot-starter-parent&lt;span class="nt"&gt;&amp;lt;/artifactId&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;version&amp;gt;&lt;/span&gt;3.3.5&lt;span class="nt"&gt;&amp;lt;/version&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;relativePath/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/parent&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Spring Boot 3 requires Java 17 or higher. So, if Maven is running with Java 11 or Java 8, the compilation will fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking the current Java version
&lt;/h2&gt;

&lt;p&gt;First, check the Java version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A problematic output could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openjdk version &lt;span class="s2"&gt;"11.0.25"&lt;/span&gt; 2024-10-15
OpenJDK Runtime Environment Homebrew
OpenJDK 64-Bit Server VM Homebrew
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the terminal is using Java 11.&lt;/p&gt;

&lt;p&gt;Then check Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Maven is also using Java 11, you may see something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Apache Maven 3.9.8
Java version: 11.0.25
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This explains the error: the project requires Java 17, but Maven is compiling with Java 11.&lt;/p&gt;

&lt;h2&gt;
  
  
  Checking installed JDKs on macOS
&lt;/h2&gt;

&lt;p&gt;On macOS, you can list the installed Java versions with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;/usr/libexec/java_home &lt;span class="nt"&gt;-V&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Matching Java Virtual Machines &lt;span class="o"&gt;(&lt;/span&gt;2&lt;span class="o"&gt;)&lt;/span&gt;:
    11.0.25 &lt;span class="o"&gt;(&lt;/span&gt;x86_64&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;"Homebrew"&lt;/span&gt; - &lt;span class="s2"&gt;"OpenJDK 11.0.25"&lt;/span&gt;
    1.8.371.11 &lt;span class="o"&gt;(&lt;/span&gt;x86_64&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="s2"&gt;"Oracle Corporation"&lt;/span&gt; - &lt;span class="s2"&gt;"Java"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the system only has Java 11 and Java 8 installed. Therefore, Java 17 must be installed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing Java 17 with Homebrew
&lt;/h2&gt;

&lt;p&gt;On macOS Intel, you can install Java 17 with Homebrew:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew &lt;span class="nb"&gt;install &lt;/span&gt;openjdk@17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On some machines, especially with older macOS or Xcode versions, Homebrew may compile several dependencies from source. This can take a long time.&lt;/p&gt;

&lt;p&gt;To check how long the installation has been running, you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps &lt;span class="nt"&gt;-axo&lt;/span&gt; pid,etime,command | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"brew|make|python|openjdk"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nb"&gt;grep&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;33961    01:14:20 /usr/local/Homebrew/Library/Homebrew/brew.rb &lt;span class="nb"&gt;install &lt;/span&gt;openjdk@17
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This means the installation has been running for approximately &lt;strong&gt;1 hour, 14 minutes, and 20 seconds&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configuring Java 17 temporarily
&lt;/h2&gt;

&lt;p&gt;Once the installation finishes, configure the current terminal session to use Java 17:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;span class="nb"&gt;hash&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then verify the Java version:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;openjdk version &lt;span class="s2"&gt;"17..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also check Maven:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Maven should now show Java 17:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;Java version: 17...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making Java 17 permanent
&lt;/h2&gt;

&lt;p&gt;To avoid repeating this configuration every time you open a new terminal, add the environment variables to your &lt;code&gt;~/.zshrc&lt;/code&gt; file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export JAVA_HOME=/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.zshrc
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s1"&gt;'export PATH=$JAVA_HOME/bin:$PATH'&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; ~/.zshrc
&lt;span class="nb"&gt;source&lt;/span&gt; ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then check again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Running the API again
&lt;/h2&gt;

&lt;p&gt;With Java 17 configured, go to your project directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; /path/to/your/project
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the project again:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;mvn clean spring-boot:run
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If everything is correct, Spring Boot should start the API on the configured port, usually:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:8080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Testing endpoints
&lt;/h2&gt;

&lt;p&gt;Some common test endpoints may be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:8080/actuator/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, if your project has a custom health endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl http://localhost:8080/api/health
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If your project includes Swagger or OpenAPI, you can check the documentation at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;http://localhost:8080/swagger-ui.html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Alternative: use Docker if you do not want to install Java 17 locally
&lt;/h2&gt;

&lt;p&gt;If installing Java 17 with Homebrew takes too long or fails because of dependencies, a practical alternative is running the API with Docker using an image that already includes Java 17.&lt;/p&gt;

&lt;p&gt;For example, a simple &lt;code&gt;Dockerfile&lt;/code&gt; could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; eclipse-temurin:17-jdk&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . .&lt;/span&gt;

&lt;span class="k"&gt;RUN &lt;/span&gt;./mvnw clean package &lt;span class="nt"&gt;-DskipTests&lt;/span&gt;

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 8080&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["java", "-jar", "target/app.jar"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another option is compiling the project locally and then copying the &lt;code&gt;.jar&lt;/code&gt; file into the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; eclipse-temurin:17-jre&lt;/span&gt;

&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;

&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; target/*.jar app.jar&lt;/span&gt;

&lt;span class="k"&gt;EXPOSE&lt;/span&gt;&lt;span class="s"&gt; 8080&lt;/span&gt;

&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["java", "-jar", "app.jar"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach avoids depending on the locally installed JDK and makes the project more portable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common errors
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Error: release version 17 not supported
&lt;/h3&gt;

&lt;p&gt;Cause: Maven is using Java 8, Java 11, or any version lower than Java 17.&lt;/p&gt;

&lt;p&gt;Solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Maven still uses Java 11
&lt;/h3&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;hash&lt;/span&gt; &lt;span class="nt"&gt;-r&lt;/span&gt;
mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If Maven still shows Java 11, check your &lt;code&gt;~/.zshrc&lt;/code&gt;, &lt;code&gt;~/.bash_profile&lt;/code&gt;, or any other environment configuration file.&lt;/p&gt;

&lt;h3&gt;
  
  
  Homebrew takes too long to install Java 17
&lt;/h3&gt;

&lt;p&gt;On older macOS versions, Homebrew may compile dependencies from source. You can monitor the process with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;ps &lt;span class="nt"&gt;-axo&lt;/span&gt; pid,etime,command | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-E&lt;/span&gt; &lt;span class="s2"&gt;"brew|make|python|openjdk"&lt;/span&gt; | &lt;span class="nb"&gt;grep&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="nb"&gt;grep&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Java 17 is installed, but Maven uses Java 11
&lt;/h3&gt;

&lt;p&gt;This usually happens when &lt;code&gt;JAVA_HOME&lt;/code&gt; points to another version.&lt;/p&gt;

&lt;p&gt;Solution:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/usr/local/opt/openjdk@17/libexec/openjdk.jdk/Contents/Home
&lt;span class="nb"&gt;export &lt;/span&gt;&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$JAVA_HOME&lt;/span&gt;/bin:&lt;span class="nv"&gt;$PATH&lt;/span&gt;
mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;The error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;release version 17 not supported
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;does not necessarily mean your Spring Boot project is incorrectly configured. In many cases, it simply means Maven is using a Java version lower than the one required by the project.&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;Spring Boot 3&lt;/strong&gt; projects, it is recommended to use &lt;strong&gt;Java 17 or higher&lt;/strong&gt;. On macOS, you can install it with Homebrew, configure &lt;code&gt;JAVA_HOME&lt;/code&gt;, and verify that Maven is using the correct version.&lt;/p&gt;

&lt;p&gt;Before changing your code or modifying the &lt;code&gt;pom.xml&lt;/code&gt;, always check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java &lt;span class="nt"&gt;-version&lt;/span&gt;
mvn &lt;span class="nt"&gt;-version&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Many times, the solution is in the development environment, not in the application itself.&lt;/p&gt;

&lt;p&gt;Hope this helps you avoid wasting time debugging your Spring Boot project when the real issue is just the local Java version.&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>api</category>
      <category>maven</category>
    </item>
    <item>
      <title>Java 8 vs Java 11 vs Java 17: Which to use and why it matters in real-world projects</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Fri, 19 Jun 2026 02:05:33 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/java-8-vs-java-11-vs-java-17-which-to-use-and-why-it-matters-in-real-world-projects-11ee</link>
      <guid>https://dev.to/cristian-jonhson/java-8-vs-java-11-vs-java-17-which-to-use-and-why-it-matters-in-real-world-projects-11ee</guid>
      <description>&lt;p&gt;Java is one of the most widely used languages in the enterprise world. Many backend applications, banking systems, REST APIs, microservices, and enterprise platforms still run on versions like Java 8, Java 11, or Java 17.&lt;/p&gt;

&lt;p&gt;But when working on real-world projects, a very common question arises:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What really changes between Java 8, Java 11, and Java 17?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In this article, we will look at the main differences between these versions, why they remain important, and which one is best to use in modern projects.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Why Compare Java 8, 11, and 17?
&lt;/h2&gt;

&lt;p&gt;Java 8, Java 11, and Java 17 marked important milestones in the evolution of the language.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Java 8&lt;/strong&gt; modernized the way code is written with lambdas, streams, and functional programming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Java 11&lt;/strong&gt; consolidated a more modular and modern stage of the JDK.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Java 17&lt;/strong&gt; became a widely used foundation for current projects with Spring Boot 3, modern Jakarta EE, and cloud-native applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In many companies, we still find legacy applications in Java 8, intermediate projects in Java 11, and recent developments in Java 17.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Quick Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;th&gt;Release Year&lt;/th&gt;
&lt;th&gt;Main Focus&lt;/th&gt;
&lt;th&gt;Common Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Java 8&lt;/td&gt;
&lt;td&gt;2014&lt;/td&gt;
&lt;td&gt;Lambdas, Streams, new Date API&lt;/td&gt;
&lt;td&gt;Legacy systems and older enterprise applications&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java 11&lt;/td&gt;
&lt;td&gt;2018&lt;/td&gt;
&lt;td&gt;JDK cleanup, HTTP Client, performance improvements&lt;/td&gt;
&lt;td&gt;Migration from Java 8 and modern backend services&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Java 17&lt;/td&gt;
&lt;td&gt;2021&lt;/td&gt;
&lt;td&gt;Records, Sealed Classes, modern language features&lt;/td&gt;
&lt;td&gt;Modern projects, Spring Boot 3 and cloud architecture&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  3. Java 8: The Great Modern Leap
&lt;/h2&gt;

&lt;p&gt;Java 8 was one of the most important versions of the language. Before Java 8, writing code to iterate through lists, filter data, or pass behavior as a parameter was much more verbose.&lt;/p&gt;

&lt;p&gt;Java 8 introduced features that changed the way we write code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Main Features of Java 8
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Lambda expressions.&lt;/li&gt;
&lt;li&gt;Stream API.&lt;/li&gt;
&lt;li&gt;Functional interfaces.&lt;/li&gt;
&lt;li&gt;Method references.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Optional&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;New date API with &lt;code&gt;java.time&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Default methods in interfaces.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Example before Java 8
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Arrays&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ana"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Luis"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Carlos"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;startsWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Example with Java 8
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;names&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Arrays&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Ana"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Luis"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Carlos"&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="n"&gt;names&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
     &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;startsWith&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"A"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
     &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;forEach&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;println&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The code with Java 8 is more declarative. Instead of saying exactly how to traverse the list, we express what we want to obtain.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Stream API in Java 8
&lt;/h2&gt;

&lt;p&gt;The Stream API allows you to work with collections in a more expressive way.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Arrays&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;asList&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Integer&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;evenNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;numbers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;filter&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;collect&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Collectors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toList&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;evenNumbers&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Result:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[2, 4, 6]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is very useful for transforming, filtering, sorting, or grouping data.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. New Date API in Java 8
&lt;/h2&gt;

&lt;p&gt;Before Java 8, working with dates using &lt;code&gt;Date&lt;/code&gt; or &lt;code&gt;Calendar&lt;/code&gt; was cumbersome.&lt;/p&gt;

&lt;p&gt;Java 8 introduced &lt;code&gt;java.time&lt;/code&gt;, a much clearer API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;LocalDate&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LocalDate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;now&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="nc"&gt;LocalDate&lt;/span&gt; &lt;span class="n"&gt;deliveryDate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;currentDate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;plusDays&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;deliveryDate&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also work with date and time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;LocalDateTime&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LocalDateTime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;now&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;java.time&lt;/code&gt; is more readable, safer, and better suited for modern applications.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Java 11: A Cleaner Version Ready for Services
&lt;/h2&gt;

&lt;p&gt;Java 11 arrived after the change in the Java release cycle. It is a widely used version in companies because it allowed migration from Java 8 to a more modern base without making too big a leap.&lt;/p&gt;

&lt;h3&gt;
  
  
  Main Features of Java 11
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;New standard HTTP Client.&lt;/li&gt;
&lt;li&gt;Use of &lt;code&gt;var&lt;/code&gt; in lambda parameters.&lt;/li&gt;
&lt;li&gt;New methods in &lt;code&gt;String&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;New methods for files.&lt;/li&gt;
&lt;li&gt;Execution of &lt;code&gt;.java&lt;/code&gt; files without prior manual compilation.&lt;/li&gt;
&lt;li&gt;Removal of some legacy modules from the JDK.&lt;/li&gt;
&lt;li&gt;Performance and security improvements.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  7. HTTP Client in Java 11
&lt;/h2&gt;

&lt;p&gt;Previously, many projects used external libraries such as Apache HttpClient, OkHttp, or RestTemplate to make HTTP requests.&lt;/p&gt;

&lt;p&gt;Java 11 incorporated a standard HTTP client in the &lt;code&gt;java.net.http&lt;/code&gt; package.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.net.URI&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.net.http.HttpClient&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.net.http.HttpRequest&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;java.net.http.HttpResponse&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;HttpClientExample&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;HttpClient&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HttpClient&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newHttpClient&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="nc"&gt;HttpRequest&lt;/span&gt; &lt;span class="n"&gt;request&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;HttpRequest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newBuilder&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;uri&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="no"&gt;URI&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;create&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://api.github.com"&lt;/span&gt;&lt;span class="o"&gt;))&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;GET&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
                &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

        &lt;span class="nc"&gt;HttpResponse&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;send&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;request&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                &lt;span class="nc"&gt;HttpResponse&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;BodyHandlers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;ofString&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt;
        &lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;statusCode&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;out&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;println&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes it possible to consume REST APIs using only the JDK, without adding an external HTTP client library.&lt;/p&gt;

</description>
      <category>java</category>
      <category>backend</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
    </item>
    <item>
      <title>How to Create a Pull Request from the Terminal Using GitHub CLI</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Wed, 17 Jun 2026 15:37:35 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/how-to-create-a-pull-request-from-a-feature-branch-to-main-using-github-cli-lm1</link>
      <guid>https://dev.to/cristian-jonhson/how-to-create-a-pull-request-from-a-feature-branch-to-main-using-github-cli-lm1</guid>
      <description>&lt;p&gt;If you work with Git every day, switching back and forth between your terminal and GitHub's web interface can interrupt your workflow.&lt;/p&gt;

&lt;p&gt;Fortunately, GitHub CLI (&lt;code&gt;gh&lt;/code&gt;) allows you to create, review, and manage Pull Requests directly from the terminal. In this guide, you'll learn how to create a Pull Request from a feature branch to &lt;code&gt;main&lt;/code&gt; without ever leaving your command line.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before getting started, make sure you have:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git installed&lt;/li&gt;
&lt;li&gt;GitHub CLI installed&lt;/li&gt;
&lt;li&gt;A GitHub account&lt;/li&gt;
&lt;li&gt;Authenticated GitHub CLI&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Authenticate with GitHub:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Verify your authentication:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh auth status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  1. Create a Feature Branch
&lt;/h2&gt;

&lt;p&gt;Start by updating your local &lt;code&gt;main&lt;/code&gt; branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
git pull origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a new feature branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature/add-user-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or using the newer Git syntax:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/add-user-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2. Make Your Changes
&lt;/h2&gt;

&lt;p&gt;After implementing your changes, check your working tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git status
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Stage and commit your changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add user service implementation"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. Push the Branch to GitHub
&lt;/h2&gt;

&lt;p&gt;Push the branch to the remote repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/add-user-service
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;-u&lt;/code&gt; flag establishes tracking between your local and remote branch.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. Create the Pull Request
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Option 1: Explicit Branch Names
&lt;/h3&gt;

&lt;p&gt;Create a Pull Request specifying both source and target branches:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--base&lt;/span&gt; main &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--head&lt;/span&gt; feature/add-user-service &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"Add user service implementation"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"This PR adds the user service and related business logic."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Option 2: Automatically Detect the Current Branch
&lt;/h3&gt;

&lt;p&gt;A cleaner approach is to let Git determine the current branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--base&lt;/span&gt; main &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--head&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;git branch &lt;span class="nt"&gt;--show-current&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"Add user service implementation"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"This PR adds the user service and related business logic."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is especially useful when working with multiple feature branches.&lt;/p&gt;

&lt;h3&gt;
  
  
  Option 3: Interactive Mode
&lt;/h3&gt;

&lt;p&gt;GitHub CLI can guide you through the process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;create
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You will be prompted to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select the base branch&lt;/li&gt;
&lt;li&gt;Select the head branch&lt;/li&gt;
&lt;li&gt;Enter a title&lt;/li&gt;
&lt;li&gt;Enter a description&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Option 4: Open GitHub's PR Form in Your Browser
&lt;/h3&gt;

&lt;p&gt;If you prefer GitHub's web interface while keeping the CLI workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command opens the Pull Request page in your browser with most fields already prefilled.&lt;/p&gt;




&lt;h2&gt;
  
  
  5. View the Pull Request
&lt;/h2&gt;

&lt;p&gt;List all Pull Requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;View details of the current Pull Request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;view
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Open the Pull Request in your browser:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;view &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Optional: Merge the Pull Request
&lt;/h2&gt;

&lt;p&gt;Once your Pull Request has been approved, you can merge it directly from the terminal.&lt;/p&gt;

&lt;p&gt;Standard merge:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;merge
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Squash merge and delete the feature branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;merge &lt;span class="nt"&gt;--squash&lt;/span&gt; &lt;span class="nt"&gt;--delete-branch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regular merge and delete the feature branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;merge &lt;span class="nt"&gt;--merge&lt;/span&gt; &lt;span class="nt"&gt;--delete-branch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Complete Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout main
git pull origin main

git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature/add-user-service

git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Add user service implementation"&lt;/span&gt;

git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/add-user-service

gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--base&lt;/span&gt; main &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--head&lt;/span&gt; &lt;span class="si"&gt;$(&lt;/span&gt;git branch &lt;span class="nt"&gt;--show-current&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"Add user service implementation"&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"This PR adds the user service and related business logic."&lt;/span&gt;

gh &lt;span class="nb"&gt;pr &lt;/span&gt;view &lt;span class="nt"&gt;--web&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Why Use GitHub CLI for Pull Requests?
&lt;/h2&gt;

&lt;p&gt;Using GitHub CLI offers several advantages:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Faster workflow&lt;/li&gt;
&lt;li&gt;Less context switching&lt;/li&gt;
&lt;li&gt;Easy automation in scripts&lt;/li&gt;
&lt;li&gt;Better productivity for terminal-first developers&lt;/li&gt;
&lt;li&gt;Seamless integration with Git and GitHub&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For developers who spend most of their day in the terminal, GitHub CLI is one of the simplest ways to streamline the Pull Request process.&lt;/p&gt;

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

&lt;p&gt;GitHub CLI makes Pull Request creation simple, fast, and efficient. Whether you prefer a fully terminal-based workflow or a hybrid approach with the browser, &lt;code&gt;gh pr create&lt;/code&gt; provides multiple ways to open Pull Requests with minimal effort.&lt;/p&gt;

&lt;p&gt;Once you get used to it, you'll rarely need to manually navigate GitHub's interface just to create a Pull Request.&lt;/p&gt;




</description>
      <category>git</category>
      <category>cli</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Most beginners misuse these Git branch commands: main, checkout -b, switch -c, and push -u explained</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Fri, 12 Jun 2026 19:27:31 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/stop-using-git-branch-commands-blindly-main-checkout-b-switch-c-and-push-u-explained-1kol</link>
      <guid>https://dev.to/cristian-jonhson/stop-using-git-branch-commands-blindly-main-checkout-b-switch-c-and-push-u-explained-1kol</guid>
      <description>&lt;h2&gt;
  
  
  Why these Git commands confuse so many beginners
&lt;/h2&gt;

&lt;p&gt;A lot of developers use these commands from memory:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git branch -M main&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git checkout -b feature/inicial&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git switch -c feature/inicial&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git push -u origin feature/inicial&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The problem?&lt;/p&gt;

&lt;p&gt;Most people can type them.&lt;br&gt;
Few people can clearly explain &lt;strong&gt;why&lt;/strong&gt; they use them.&lt;/p&gt;

&lt;p&gt;And that matters.&lt;/p&gt;

&lt;p&gt;Because if you do not understand what these commands actually do, you will eventually mess up your branch flow, push to the wrong place, or confuse yourself when working across multiple repos.&lt;/p&gt;

&lt;p&gt;Let’s fix that.&lt;/p&gt;


&lt;h2&gt;
  
  
  The real meaning of &lt;code&gt;git branch -M main&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;This command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;renames your current branch to &lt;code&gt;main&lt;/code&gt;.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The important part is &lt;code&gt;-M&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It is basically the forced version of branch rename:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-m&lt;/code&gt; → rename branch&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;-M&lt;/code&gt; → rename branch and force it if needed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So when you run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You are not “creating GitHub main magic.”&lt;br&gt;
You are simply saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Rename whatever branch I am currently on to &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;
  
  
  What about &lt;code&gt;master&lt;/code&gt;?
&lt;/h3&gt;

&lt;p&gt;This command works the same way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The only difference is the target name.&lt;/p&gt;

&lt;p&gt;Historically, many repositories used &lt;code&gt;master&lt;/code&gt;.&lt;br&gt;
Today, most modern repositories default to &lt;code&gt;main&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Better option for brand new repos
&lt;/h3&gt;

&lt;p&gt;If the repository is brand new, this is cleaner:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init &lt;span class="nt"&gt;-b&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That way, you start with &lt;code&gt;main&lt;/code&gt; immediately and avoid renaming later.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;code&gt;git checkout -b&lt;/code&gt; vs &lt;code&gt;git switch -c&lt;/code&gt;: same result, different philosophy
&lt;/h2&gt;

&lt;p&gt;These two commands are often used for the exact same outcome.&lt;/p&gt;

&lt;h3&gt;
  
  
  Classic Git style
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Modern Git style
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both commands:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;create a new branch&lt;/li&gt;
&lt;li&gt;move you to that branch immediately&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So why do we have both?&lt;/p&gt;

&lt;h3&gt;
  
  
  Because &lt;code&gt;checkout&lt;/code&gt; does too much
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;git checkout&lt;/code&gt; is one of those old Git commands that can do many unrelated things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;switch branches&lt;/li&gt;
&lt;li&gt;restore files&lt;/li&gt;
&lt;li&gt;move around history&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That flexibility is powerful, but also confusing.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;git switch&lt;/code&gt; was introduced to make the intent much clearer.&lt;/p&gt;

&lt;p&gt;When you write:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it is obvious that you are doing branch work.&lt;/p&gt;

&lt;p&gt;That is why many teams now prefer &lt;code&gt;switch&lt;/code&gt; for teaching and day-to-day use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Which one should you use?
&lt;/h3&gt;

&lt;p&gt;If you are working on a modern Git version, prefer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is clearer, easier to teach, and easier to read.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why &lt;code&gt;git push -u origin feature/inicial&lt;/code&gt; is more important than people think
&lt;/h2&gt;

&lt;p&gt;Creating a local branch is only half the job.&lt;/p&gt;

&lt;p&gt;Until you push it, GitHub does not know it exists.&lt;/p&gt;

&lt;p&gt;That is where this command comes in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It does &lt;strong&gt;two things at once&lt;/strong&gt;:&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Pushes the branch to the remote
&lt;/h3&gt;

&lt;p&gt;It sends your local &lt;code&gt;feature/inicial&lt;/code&gt; branch to the remote called &lt;code&gt;origin&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Sets upstream tracking
&lt;/h3&gt;

&lt;p&gt;This is the part beginners usually skip over.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;-u&lt;/code&gt; means Git remembers the relationship between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;your local branch&lt;/li&gt;
&lt;li&gt;the remote branch it tracks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So after this first push, you can usually just run:&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;p&gt;and later:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git pull
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;without typing the full branch name again.&lt;/p&gt;

&lt;p&gt;That is why &lt;code&gt;-u&lt;/code&gt; is such a useful habit.&lt;/p&gt;




&lt;h2&gt;
  
  
  The workflow most beginners actually need
&lt;/h2&gt;

&lt;p&gt;If you want a simple, clean branch workflow, use this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init &lt;span class="nt"&gt;-b&lt;/span&gt; main
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you already initialized the repository and need to rename the current branch first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is enough for a huge number of personal projects and team workflows.&lt;/p&gt;




&lt;h2&gt;
  
  
  Can you do this with &lt;code&gt;gh&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;Partly, yes.&lt;/p&gt;

&lt;p&gt;GitHub CLI is excellent for GitHub-related actions, but it does not replace core Git branch commands in the normal day-to-day flow.&lt;/p&gt;

&lt;h3&gt;
  
  
  What &lt;code&gt;gh&lt;/code&gt; does well
&lt;/h3&gt;

&lt;p&gt;It is great for creating the remote repository from the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo create my-project &lt;span class="nt"&gt;--public&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin &lt;span class="nt"&gt;--push&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That command can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;create the GitHub repo&lt;/li&gt;
&lt;li&gt;connect it as &lt;code&gt;origin&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;push your local code&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  What you should still do with Git
&lt;/h3&gt;

&lt;p&gt;For regular local branch creation, Git is still the standard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Where &lt;code&gt;gh&lt;/code&gt; becomes really useful again
&lt;/h3&gt;

&lt;p&gt;Once the branch exists, &lt;code&gt;gh&lt;/code&gt; is excellent for pull requests:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh &lt;span class="nb"&gt;pr &lt;/span&gt;create &lt;span class="nt"&gt;--base&lt;/span&gt; main &lt;span class="nt"&gt;--head&lt;/span&gt; feature/inicial &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"Create initial feature branch"&lt;/span&gt; &lt;span class="nt"&gt;--body&lt;/span&gt; &lt;span class="s2"&gt;"This PR introduces the initial feature branch."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And if your team uses GitHub issues, there is a very useful workflow around issue-based branch creation.&lt;/p&gt;




&lt;h2&gt;
  
  
  The mistake many people make
&lt;/h2&gt;

&lt;p&gt;They memorize the command.&lt;br&gt;
They never learn the intent.&lt;/p&gt;

&lt;p&gt;So they end up asking things like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Why didn’t my branch appear on GitHub?”&lt;/li&gt;
&lt;li&gt;“Why does &lt;code&gt;git push&lt;/code&gt; say there is no upstream branch?”&lt;/li&gt;
&lt;li&gt;“Why do I have &lt;code&gt;master&lt;/code&gt; locally and &lt;code&gt;main&lt;/code&gt; remotely?”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The answer is almost always the same:&lt;/p&gt;

&lt;p&gt;They followed commands mechanically instead of understanding the branch lifecycle.&lt;/p&gt;

&lt;p&gt;That lifecycle is simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;create repo → define main branch → create feature branch → push and track upstream → open PR&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you see that flow, the commands stop feeling random.&lt;/p&gt;


&lt;h2&gt;
  
  
  Final takeaway
&lt;/h2&gt;

&lt;p&gt;If you only keep one mental model from this article, keep this one:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;git branch -M main&lt;/code&gt; → rename current branch to &lt;code&gt;main&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git checkout -b name&lt;/code&gt; → create branch and switch to it&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git switch -c name&lt;/code&gt; → same goal, cleaner modern syntax&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;git push -u origin name&lt;/code&gt; → publish the branch and set upstream tracking&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gh&lt;/code&gt; → great for repo creation and PR workflows, not a full replacement for Git branch work&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Git is easier when you stop memorizing commands and start understanding the sequence.&lt;/p&gt;

&lt;p&gt;That is when branching becomes predictable instead of stressful.&lt;/p&gt;


&lt;h2&gt;
  
  
  Quick command summary
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init &lt;span class="nt"&gt;-b&lt;/span&gt; main
git switch &lt;span class="nt"&gt;-c&lt;/span&gt; feature/inicial
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin feature/inicial
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If the repo already exists and you need to rename the current branch:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you want to create the GitHub repository from the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo create my-project &lt;span class="nt"&gt;--public&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin &lt;span class="nt"&gt;--push&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What do you prefer in your daily workflow: &lt;code&gt;git checkout -b&lt;/code&gt; or &lt;code&gt;git switch -c&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;If you are teaching Git to juniors, standardizing team workflows, or just trying to stop fighting branch confusion every week, start by simplifying the mental model—not just the commands.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>beginners</category>
      <category>devops</category>
    </item>
    <item>
      <title>Reset, revert, and reflog: the ultimate guide to undoing commits without losing your repo</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Wed, 10 Jun 2026 20:56:25 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/reset-revert-and-reflog-the-ultimate-guide-to-undoing-commits-without-losing-your-repo-3dp8</link>
      <guid>https://dev.to/cristian-jonhson/reset-revert-and-reflog-the-ultimate-guide-to-undoing-commits-without-losing-your-repo-3dp8</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;😰 &lt;strong&gt;Story time:&lt;/strong&gt; I ran &lt;code&gt;git reset --hard HEAD~1&lt;/code&gt;, force pushed… and then realized I needed that file back.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not pushed yet → &lt;code&gt;reset&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Pushed + shared branch → &lt;code&gt;revert&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;“Lost” a commit → &lt;code&gt;git reflog&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The real-world scenario
&lt;/h2&gt;

&lt;p&gt;You’re working on a repo and you create commits like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;chore: remove compiled artifacts from the repository&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;chore: add .gitignore to exclude unnecessary files&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then you try to undo the last commit, you run &lt;code&gt;push --force-with-lease&lt;/code&gt;, and later you say:  &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I need to recover that file.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Let’s go step by step.&lt;/p&gt;




&lt;h2&gt;
  
  
  1) Undo the last commits: reset vs revert
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Rule of thumb:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ Working alone / not pushed yet → use &lt;code&gt;reset&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;👥 Shared branch / already pushed → use &lt;code&gt;revert&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before you copy/paste commands, get your current branch name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;--show-current&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Use that value wherever you see &lt;code&gt;YOUR_BRANCH&lt;/code&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  Option A: &lt;code&gt;reset&lt;/code&gt; (rewrites history)
&lt;/h3&gt;

&lt;p&gt;Useful when you want those commits to &lt;strong&gt;disappear from the history&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deletes commits and discards changes&lt;/strong&gt; (hard mode):
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reset &lt;span class="nt"&gt;--hard&lt;/span&gt; HEAD~2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Deletes commits but keeps changes staged&lt;/strong&gt; (soft mode):
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reset &lt;span class="nt"&gt;--soft&lt;/span&gt; HEAD~2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="crayons-card c-embed"&gt;

  &lt;br&gt;
&lt;strong&gt;GitHub note (force push):&lt;/strong&gt; If you already pushed, to make the remote match you must force push.&lt;br&gt;&lt;br&gt;
Avoid &lt;code&gt;--force&lt;/code&gt; and use:&lt;br&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt; origin YOUR_BRANCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;✅ &lt;code&gt;--force-with-lease&lt;/code&gt; is safer because it won’t overwrite remote work you don’t have locally.&lt;/p&gt;

&lt;p&gt;⚠️ If the branch is &lt;strong&gt;protected&lt;/strong&gt; (common on &lt;code&gt;main/master&lt;/code&gt;), GitHub may block force pushes.&lt;br&gt;

&lt;/p&gt;
&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt; origin master
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Option B: &lt;code&gt;revert&lt;/code&gt; (does NOT rewrite history)
&lt;/h3&gt;

&lt;p&gt;Recommended when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Other people are working on the repo&lt;/li&gt;
&lt;li&gt;The branch is shared&lt;/li&gt;
&lt;li&gt;The branch is protected (e.g., &lt;code&gt;main/master&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It creates &lt;strong&gt;new commits&lt;/strong&gt; that undo the changes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git revert &lt;span class="nt"&gt;--no-edit&lt;/span&gt; HEAD~2..HEAD
git push origin YOUR_BRANCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  2) Recover commits after &lt;code&gt;reset --hard&lt;/code&gt; with &lt;code&gt;reflog&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;If you ran:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reset &lt;span class="nt"&gt;--hard&lt;/span&gt; HEAD~1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then regretted it, your lifeline is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reflog
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Real example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dc65430 HEAD@{0}: reset: moving to HEAD~1
3bfb189 HEAD@{1}: commit: chore: add .gitignore to exclude unnecessary files
dc65430 HEAD@{2}: commit: chore: remove compiled artifacts from the repository
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can see the “lost” commit still exists: &lt;code&gt;3bfb189&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To return to that state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git reset &lt;span class="nt"&gt;--hard&lt;/span&gt; 3bfb189
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you also want GitHub to match:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt; origin YOUR_BRANCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3) Restore a specific file from an earlier commit
&lt;/h2&gt;

&lt;p&gt;Sometimes you don’t want to move the whole branch—only recover &lt;strong&gt;one file&lt;/strong&gt; that existed in a past commit.&lt;/p&gt;

&lt;h3&gt;
  
  
  Important
&lt;/h3&gt;

&lt;p&gt;This command &lt;em&gt;always&lt;/em&gt; requires a path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore &lt;span class="nt"&gt;--source&lt;/span&gt; &amp;lt;COMMIT&amp;gt; &lt;span class="nt"&gt;--&lt;/span&gt; &amp;lt;FILE_PATH&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Common example: restore &lt;code&gt;.gitignore&lt;/code&gt; from &lt;code&gt;3bfb189&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore &lt;span class="nt"&gt;--source&lt;/span&gt; 3bfb189 &lt;span class="nt"&gt;--&lt;/span&gt; .gitignore
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then save it in history:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add .gitignore
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"chore: restore .gitignore"&lt;/span&gt;
git push origin YOUR_BRANCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;/p&gt;
  Don’t know the exact file path?
  &lt;br&gt;
List the files touched by that commit:&lt;br&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git show &lt;span class="nt"&gt;--name-status&lt;/span&gt; &lt;span class="nt"&gt;--pretty&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; 3bfb189
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Or list everything that exists in that commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git ls-tree &lt;span class="nt"&gt;-r&lt;/span&gt; 3bfb189 &lt;span class="nt"&gt;--name-only&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;br&gt;
&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Once you find the exact path, restore it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore &lt;span class="nt"&gt;--source&lt;/span&gt; 3bfb189 &lt;span class="nt"&gt;--&lt;/span&gt; real/path/to/file.ext
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Restore EVERYTHING from a commit (warning: overwrites)
&lt;/h3&gt;

&lt;p&gt;⚠️ This can overwrite local changes in your working tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git restore &lt;span class="nt"&gt;--source&lt;/span&gt; 3bfb189 &lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4) Change the last commit message
&lt;/h2&gt;

&lt;h3&gt;
  
  
  If you have NOT pushed yet
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"new message"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  If you ALREADY pushed to GitHub
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;--amend&lt;/span&gt; &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"new message"&lt;/span&gt;
git push &lt;span class="nt"&gt;--force-with-lease&lt;/span&gt; origin YOUR_BRANCH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  5) Tips to avoid Git pain (seriously)
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Before doing an aggressive reset, create a “backup branch”:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch backup-before-reset
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Prefer &lt;code&gt;--force-with-lease&lt;/code&gt; over &lt;code&gt;--force&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;If you’re working with a team, prefer &lt;code&gt;revert&lt;/code&gt; over &lt;code&gt;reset&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reflog&lt;/code&gt; is your “secret history”: when something “disappears”, check &lt;code&gt;git reflog&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;If you ever feel like you “lost” commits or files, remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;git reflog&lt;/code&gt;&lt;/strong&gt; finds the commit you can’t see anymore&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;git restore --source&lt;/code&gt;&lt;/strong&gt; restores specific files without breaking everything&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;reset&lt;/code&gt;&lt;/strong&gt; rewrites history (requires force push)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;revert&lt;/code&gt;&lt;/strong&gt; is team-friendly&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Your turn 👻
&lt;/h2&gt;

&lt;p&gt;What’s your worst Git mistake? Did you manage to recover it, or did you have to start over? Drop your story in the comments.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>How to Create a GitHub Repository from the Terminal Using GitHub CLI</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Wed, 10 Jun 2026 20:44:15 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/how-to-create-a-github-repository-from-the-terminal-using-github-cli-2629</link>
      <guid>https://dev.to/cristian-jonhson/how-to-create-a-github-repository-from-the-terminal-using-github-cli-2629</guid>
      <description>&lt;p&gt;When working on a local project, we usually create the repository on GitHub first, copy the remote URL, and then connect it to our local project.&lt;/p&gt;

&lt;p&gt;But there is a cleaner way to do it directly from the terminal using &lt;strong&gt;GitHub CLI&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Initialize Git in Your Project
&lt;/h2&gt;

&lt;p&gt;Go to your project folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd &lt;/span&gt;your-project-name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Initialize Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Authenticate with GitHub CLI
&lt;/h2&gt;

&lt;p&gt;If you have not logged in yet, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh auth login
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;During the process, you can choose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GitHub.com
SSH
Login with a web browser
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Create the Remote Repository from Local
&lt;/h2&gt;

&lt;p&gt;To create the repository on GitHub and add it as &lt;code&gt;origin&lt;/code&gt;, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo create repository-name &lt;span class="nt"&gt;--public&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo create IA_ML_DL_python_fundamentos &lt;span class="nt"&gt;--public&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For a private repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh repo create repository-name &lt;span class="nt"&gt;--private&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Verify the Remote
&lt;/h2&gt;

&lt;p&gt;Check that &lt;code&gt;origin&lt;/code&gt; was added correctly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git remote &lt;span class="nt"&gt;-v&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You should see something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;origin  git@github.com:username/repository-name.git &lt;span class="o"&gt;(&lt;/span&gt;fetch&lt;span class="o"&gt;)&lt;/span&gt;
origin  git@github.com:username/repository-name.git &lt;span class="o"&gt;(&lt;/span&gt;push&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Create the First Commit
&lt;/h2&gt;

&lt;p&gt;Add your files:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the first commit:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  6. Push the Project to GitHub
&lt;/h2&gt;

&lt;p&gt;Make sure your main branch is named &lt;code&gt;main&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Push your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Full Command Summary
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git init
gh auth login
gh repo create repository-name &lt;span class="nt"&gt;--public&lt;/span&gt; &lt;span class="nt"&gt;--source&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;--remote&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;origin
git add &lt;span class="nb"&gt;.&lt;/span&gt;
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"Initial commit"&lt;/span&gt;
git branch &lt;span class="nt"&gt;-M&lt;/span&gt; main
git push &lt;span class="nt"&gt;-u&lt;/span&gt; origin main
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Using &lt;code&gt;gh repo create&lt;/code&gt; allows you to create a GitHub repository directly from the terminal, connect it as &lt;code&gt;origin&lt;/code&gt;, and push your local project without manually creating the repository from the browser.&lt;/p&gt;

&lt;p&gt;It is a faster, cleaner, and more professional workflow for starting new projects on GitHub.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>cli</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Getting Started with AWS: A Practical Guide for Beginners</title>
      <dc:creator>Cristian Jonhson Alvarez</dc:creator>
      <pubDate>Mon, 06 Jan 2025 18:28:52 +0000</pubDate>
      <link>https://dev.to/cristian-jonhson/getting-started-with-aws-a-practical-guide-for-beginner-4aj1</link>
      <guid>https://dev.to/cristian-jonhson/getting-started-with-aws-a-practical-guide-for-beginner-4aj1</guid>
      <description>&lt;p&gt;By the end, you’ll know exactly what to learn first on AWS—and you’ll have 2 mini-projects to prove it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ &lt;strong&gt;Plus&lt;/strong&gt;: you’ll set up Budgets on day one to avoid surprise costs.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start with &lt;strong&gt;EC2, S3, IAM, RDS&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Build 1–2 tiny projects (static website + simple API)&lt;/li&gt;
&lt;li&gt;Keep costs under control from day one (Budgets + Free Tier)&lt;/li&gt;
&lt;li&gt;✅ “Set up AWS Budgets on day 1 to avoid surprise bills.”&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Table of contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;1. What is AWS, and why should you learn it?&lt;/li&gt;
&lt;li&gt;2. Create your AWS account (and avoid surprise costs)&lt;/li&gt;
&lt;li&gt;3. Get familiar with the AWS Console&lt;/li&gt;
&lt;li&gt;4. Learn the core services (first 4)&lt;/li&gt;
&lt;li&gt;5. Build your first projects&lt;/li&gt;
&lt;li&gt;6. Training and certifications&lt;/li&gt;
&lt;li&gt;7. Join the community&lt;/li&gt;
&lt;li&gt;8. Final tips&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  1. What is AWS, and why should you learn it?
&lt;/h2&gt;

&lt;p&gt;AWS is a set of cloud services that lets you build and run applications without managing physical servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why learn AWS?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Job opportunities:&lt;/strong&gt; AWS skills are in high demand across dev, DevOps, data, and security.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Versatility:&lt;/strong&gt; You can build websites, APIs, databases, analytics, CI/CD, and more.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pay-as-you-go:&lt;/strong&gt; You can start small and only pay for what you use.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. Create your AWS account (and avoid surprise costs)
&lt;/h2&gt;

&lt;p&gt;To start, you need an AWS account:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://aws.amazon.com/" rel="noopener noreferrer"&gt;https://aws.amazon.com/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Click &lt;strong&gt;Create a Free Account&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Register with email + credit card (AWS uses it for verification and billing)&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ &lt;strong&gt;Cost safety tip (do this immediately):&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Set up &lt;strong&gt;AWS Budgets&lt;/strong&gt; and billing alerts the same day you create the account.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;“Go to Billing → Budgets → Create budget (monthly)”.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Free Tier basics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS offers a Free Tier for many services (some are 12 months, some always-free, some trials).&lt;/li&gt;
&lt;li&gt;Always check pricing pages before creating resources.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  3. Get familiar with the AWS Console
&lt;/h2&gt;

&lt;p&gt;The AWS Management Console is where you’ll create and manage services.&lt;/p&gt;

&lt;p&gt;Spend time on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Navigating services (search bar is your best friend)&lt;/li&gt;
&lt;li&gt;Switching &lt;strong&gt;regions&lt;/strong&gt; (top-right)&lt;/li&gt;
&lt;li&gt;Understanding IAM users/roles (more below)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pro tip:&lt;/strong&gt; Learn the AWS CLI once you’re comfortable in the console:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;aws &lt;span class="nt"&gt;--version&lt;/span&gt;
aws sts get-caller-identity
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. Learn the core services (first 4)
&lt;/h2&gt;

&lt;p&gt;If you only learn these 4 first, you’ll already understand most AWS basics.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.1 EC2 (Elastic Compute Cloud)
&lt;/h3&gt;

&lt;p&gt;Virtual servers in the cloud.&lt;/p&gt;

&lt;p&gt;Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Launch an instance (Amazon Linux / Ubuntu)&lt;/li&gt;
&lt;li&gt;Connect via SSH&lt;/li&gt;
&lt;li&gt;Stop/terminate it to avoid costs&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ Reminder: Stop/terminate your instance when done.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  4.2 S3 (Simple Storage Service)
&lt;/h3&gt;

&lt;p&gt;Object storage for files (images, backups, static websites).&lt;/p&gt;

&lt;p&gt;Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a bucket&lt;/li&gt;
&lt;li&gt;Upload/download files&lt;/li&gt;
&lt;li&gt;Learn permissions (private vs public)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4.3 RDS (Relational Database Service)
&lt;/h3&gt;

&lt;p&gt;Managed databases (PostgreSQL, MySQL, etc).&lt;/p&gt;

&lt;p&gt;Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a small PostgreSQL instance (Free Tier eligible if available)&lt;/li&gt;
&lt;li&gt;Connect from local app&lt;/li&gt;
&lt;li&gt;Learn basics: security groups + subnet groups&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4.4 IAM (Identity and Access Management)
&lt;/h3&gt;

&lt;p&gt;Users, roles, permissions.&lt;/p&gt;

&lt;p&gt;Practice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create an IAM user with least privilege&lt;/li&gt;
&lt;li&gt;Create an IAM role (used by EC2/Lambda)&lt;/li&gt;
&lt;li&gt;Learn policies (managed vs inline)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;🔥 If you learn IAM early, you’ll avoid most “why is access denied?” pain later.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. Build your first projects
&lt;/h2&gt;

&lt;p&gt;The fastest way to learn AWS is to build.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project 1: Static website with S3 + CloudFront
&lt;/h3&gt;

&lt;p&gt;Goal: host a simple website (HTML/CSS/JS) in S3 and deliver it via CDN.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload site files to S3&lt;/li&gt;
&lt;li&gt;Configure static hosting (or private bucket + CloudFront)&lt;/li&gt;
&lt;li&gt;(Optional) Add a custom domain with Route 53&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Project 2: Serverless API with Lambda + API Gateway
&lt;/h3&gt;

&lt;p&gt;Goal: create a tiny API endpoint (e.g., &lt;code&gt;/hello&lt;/code&gt;) without managing servers.&lt;/p&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Lambda function (Node/Python)&lt;/li&gt;
&lt;li&gt;Expose it via API Gateway&lt;/li&gt;
&lt;li&gt;Test it with curl/Postman&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Training and certifications
&lt;/h2&gt;

&lt;p&gt;If you want a structured path:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS Skill Builder (official training)&lt;/li&gt;
&lt;li&gt;AWS Docs (learn service-by-service)&lt;/li&gt;
&lt;li&gt;YouTube channels / labs / hands-on projects&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A common first cert:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AWS Certified Cloud Practitioner (CLF)&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  7. Join the community
&lt;/h2&gt;

&lt;p&gt;Learning is easier with people:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS re:Invent sessions (even recorded ones)&lt;/li&gt;
&lt;li&gt;Local meetups&lt;/li&gt;
&lt;li&gt;DEV posts / discussions / GitHub projects&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  8. Final tips
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Go one service at a time&lt;/strong&gt; — don’t try to learn everything.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Document your progress&lt;/strong&gt; — keep a repo or a DEV series.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn things off&lt;/strong&gt; — most surprise bills come from resources left running.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security mindset early&lt;/strong&gt; — IAM + least privilege always.&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;AWS is huge, but starting doesn’t have to be complicated.&lt;br&gt;&lt;br&gt;
If you focus on the core services and build 1–2 small projects, you’ll quickly feel confident navigating AWS.&lt;/p&gt;




&lt;h2&gt;
  
  
  Your turn 👇
&lt;/h2&gt;

&lt;p&gt;What was the &lt;strong&gt;first AWS service&lt;/strong&gt; that “clicked” for you? - And what’s the best beginner project to learn it?&lt;/p&gt;

</description>
      <category>aws</category>
      <category>cloud</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
